aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-14 12:40:17 +0800
committerGitHub <noreply@github.com>2024-03-14 12:40:17 +0800
commit3502aa63f0f4ea8d8982aea81a819424e71029bc (patch)
tree19ca1815ad70b025d51d86c48254551bb9cb7dbb
parentb501a2354f5f3f348a7a72bc38bc6f7cfe627b1a (diff)
downloadrneovim-3502aa63f0f4ea8d8982aea81a819424e71029bc.tar.gz
rneovim-3502aa63f0f4ea8d8982aea81a819424e71029bc.tar.bz2
rneovim-3502aa63f0f4ea8d8982aea81a819424e71029bc.zip
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) https://github.com/vim/vim/commit/4b93674159d60c985de906c30f45dbaf2b64056f Most of the patch is already merged. Add an assertion in place of "added". Co-authored-by: LemonBoy <thatlemon@gmail.com>
-rw-r--r--src/nvim/ops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index af5f2fae34..3dcbe597fe 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -408,6 +408,7 @@ static void shift_block(oparg_T *oap, int amount)
memset(newp + bd.textcol + tabs, ' ', (size_t)spaces);
// Note that STRMOVE() copies the trailing NUL.
STRMOVE(newp + bd.textcol + tabs + spaces, bd.textstart);
+ assert(newlen - oldlen == (colnr_T)new_line_len - get_cursor_line_len());
} else { // left
char *verbatim_copy_end; // end of the part of the line which is
// copied verbatim
@@ -494,6 +495,7 @@ static void shift_block(oparg_T *oap, int amount)
memset(newp + verbatim_diff, ' ', fill);
// Note that STRMOVE() copies the trailing NUL.
STRMOVE(newp + verbatim_diff + fill, non_white);
+ assert(newlen - oldlen == (colnr_T)new_line_len - get_cursor_line_len());
}
// replace the line
ml_replace(curwin->w_cursor.lnum, newp, false);