mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 05:28:33 +00:00
vim-patch:8.2.4950: text properties position wrong after shifting text (#27849)
Problem: Text properties position wrong after shifting text.
Solution: Adjust the text properties when shifting a block of text.
(closes vim/vim#10418)
4b93674159
Most of the patch is already merged. Add an assertion in place of "added".
Co-authored-by: LemonBoy <thatlemon@gmail.com>
This commit is contained in:
@@ -408,6 +408,7 @@ static void shift_block(oparg_T *oap, int amount)
|
|||||||
memset(newp + bd.textcol + tabs, ' ', (size_t)spaces);
|
memset(newp + bd.textcol + tabs, ' ', (size_t)spaces);
|
||||||
// Note that STRMOVE() copies the trailing NUL.
|
// Note that STRMOVE() copies the trailing NUL.
|
||||||
STRMOVE(newp + bd.textcol + tabs + spaces, bd.textstart);
|
STRMOVE(newp + bd.textcol + tabs + spaces, bd.textstart);
|
||||||
|
assert(newlen - oldlen == (colnr_T)new_line_len - get_cursor_line_len());
|
||||||
} else { // left
|
} else { // left
|
||||||
char *verbatim_copy_end; // end of the part of the line which is
|
char *verbatim_copy_end; // end of the part of the line which is
|
||||||
// copied verbatim
|
// copied verbatim
|
||||||
@@ -494,6 +495,7 @@ static void shift_block(oparg_T *oap, int amount)
|
|||||||
memset(newp + verbatim_diff, ' ', fill);
|
memset(newp + verbatim_diff, ' ', fill);
|
||||||
// Note that STRMOVE() copies the trailing NUL.
|
// Note that STRMOVE() copies the trailing NUL.
|
||||||
STRMOVE(newp + verbatim_diff + fill, non_white);
|
STRMOVE(newp + verbatim_diff + fill, non_white);
|
||||||
|
assert(newlen - oldlen == (colnr_T)new_line_len - get_cursor_line_len());
|
||||||
}
|
}
|
||||||
// replace the line
|
// replace the line
|
||||||
ml_replace(curwin->w_cursor.lnum, newp, false);
|
ml_replace(curwin->w_cursor.lnum, newp, false);
|
||||||
|
Reference in New Issue
Block a user