From bdebe8516c90839930acbfe3c6f1e354ee56df3f Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Fri, 29 Jun 2018 13:35:42 +0200 Subject: bufhl: use extmark column adjustment for bufhl NB: this is not the final implementation. Bufhl should be made a part of the extmark tree, so that "start" adjustment just works automatically. But "stop" will still need some ad-hoc trickery, until extended marks natively support ranges (hopefully sooner than forever). --- src/nvim/edit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index cd0f3f4b9d..6e38801728 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5599,9 +5599,10 @@ insertchar ( do_digraph(-1); /* clear digraphs */ do_digraph(buf[i-1]); /* may be the start of a digraph */ buf[i] = NUL; + colnr_T col_start = curwin->w_cursor.col; ins_str(buf); extmark_col_adjust(curbuf, curwin->w_cursor.lnum, - (colnr_T)(curwin->w_cursor.col + 1), 0, + (colnr_T)(col_start + 1), 0, (long)STRLEN(buf), kExtmarkUndo); if (flags & INSCHAR_CTRLV) { redo_literal(*buf); -- cgit From 2cc83c961c0533222890adec51ac56041fb2a6b4 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Thu, 14 Nov 2019 20:06:13 +0100 Subject: refactor: use inserted_bytes pattern from vim This covers all "small" inserts and deletes in insert mode, as well as a few more cases like small normal mode deletes vim-patch:8.1.0678: text properties as not adjusted for inserted text --- src/nvim/edit.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 6e38801728..eecea03a19 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -5599,11 +5599,7 @@ insertchar ( do_digraph(-1); /* clear digraphs */ do_digraph(buf[i-1]); /* may be the start of a digraph */ buf[i] = NUL; - colnr_T col_start = curwin->w_cursor.col; ins_str(buf); - extmark_col_adjust(curbuf, curwin->w_cursor.lnum, - (colnr_T)(col_start + 1), 0, - (long)STRLEN(buf), kExtmarkUndo); if (flags & INSCHAR_CTRLV) { redo_literal(*buf); i = 1; @@ -5614,9 +5610,6 @@ insertchar ( } else { int cc; - extmark_col_adjust(curbuf, curwin->w_cursor.lnum, - (colnr_T)(curwin->w_cursor.col + 1), 0, - 1, kExtmarkUndo); if ((cc = utf_char2len(c)) > 1) { char_u buf[MB_MAXBYTES + 1]; @@ -8507,14 +8500,6 @@ static bool ins_tab(void) temp -= get_nolist_virtcol() % temp; - // Move extmarks - extmark_col_adjust(curbuf, - curwin->w_cursor.lnum, - curwin->w_cursor.col, - 0, - temp, - kExtmarkUndo); - /* * Insert the first space with ins_char(). It will delete one char in * replace mode. Insert the rest with ins_str(); it will not delete any -- cgit