aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorchentau <tchen1998@gmail.com>2021-03-12 12:49:10 -0800
committerchentau <tchen1998@gmail.com>2021-03-22 20:26:25 -0700
commita92a8ef506ecd154fec429457dee99708a047f2f (patch)
treecd3540c515a4cc51c93737b102cc18cc37eca5a2 /src/nvim/edit.c
parentd41778c993e95c8b37b3d8e10dacc3060ae489da (diff)
downloadrneovim-a92a8ef506ecd154fec429457dee99708a047f2f.tar.gz
rneovim-a92a8ef506ecd154fec429457dee99708a047f2f.tar.bz2
rneovim-a92a8ef506ecd154fec429457dee99708a047f2f.zip
Correctly splice extmarks on tab with noexpandtab set
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index cffa46fa77..b5d5d67e90 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -8764,6 +8764,10 @@ static bool ins_tab(void)
getvcol(curwin, &fpos, &vcol, NULL, NULL);
getvcol(curwin, cursor, &want_vcol, NULL, NULL);
+ // save start of changed region for extmark_splice
+ int start_row = fpos.lnum;
+ colnr_T start_col = fpos.col;
+
// Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
// and 'linebreak' adding extra virtual columns.
while (ascii_iswhite(*ptr)) {
@@ -8813,6 +8817,11 @@ static bool ins_tab(void)
replace_join(repl_off);
}
}
+ if (!(State & VREPLACE_FLAG)) {
+ extmark_splice_cols(curbuf, start_row - 1, start_col,
+ cursor->col - start_col, fpos.col - start_col,
+ kExtmarkUndo);
+ }
}
cursor->col -= i;