mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:8.2.3348: line2byte() returns wrong value after adding textprop
Problem: line2byte() returns wrong value after adding textprop. (Yuto
Kimura)
Solution: Reduce the length by the size of the text property. (closes vim/vim#8759)
14c7530c4f
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2870,7 +2870,9 @@ static void ml_flush_line(buf_T *buf, bool noalloc)
|
|||||||
memmove(old_line - extra, new_line, (size_t)new_len);
|
memmove(old_line - extra, new_line, (size_t)new_len);
|
||||||
buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
|
buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
|
||||||
// The else case is already covered by the insert and delete
|
// The else case is already covered by the insert and delete
|
||||||
|
if (extra != 0) {
|
||||||
ml_updatechunk(buf, lnum, extra, ML_CHNK_UPDLINE);
|
ml_updatechunk(buf, lnum, extra, ML_CHNK_UPDLINE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Cannot do it in one data block: Delete and append.
|
// Cannot do it in one data block: Delete and append.
|
||||||
// Append first, because ml_delete_int() cannot delete the
|
// Append first, because ml_delete_int() cannot delete the
|
||||||
@@ -4003,7 +4005,7 @@ int ml_find_line_or_offset(buf_T *buf, linenr_T lnum, int *offp, bool no_ff)
|
|||||||
return 1; // Not a "find offset" and offset 0 _must_ be in line 1
|
return 1; // Not a "find offset" and offset 0 _must_ be in line 1
|
||||||
}
|
}
|
||||||
// Find the last chunk before the one containing our line. Last chunk is
|
// Find the last chunk before the one containing our line. Last chunk is
|
||||||
// special because it will never qualify
|
// special because it will never qualify.
|
||||||
linenr_T curline = 1;
|
linenr_T curline = 1;
|
||||||
int curix = 0;
|
int curix = 0;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
Reference in New Issue
Block a user