aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/edit.c8
-rw-r--r--src/nvim/ex_cmds.c5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 49bd170bcd..be0ab33d08 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -8787,10 +8787,6 @@ 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)) {
@@ -8841,8 +8837,8 @@ static bool ins_tab(void)
}
}
if (!(State & VREPLACE_FLAG)) {
- extmark_splice_cols(curbuf, start_row - 1, start_col,
- cursor->col - start_col, fpos.col - start_col,
+ extmark_splice_cols(curbuf, fpos.lnum - 1, change_col,
+ cursor->col - change_col, fpos.col - change_col,
kExtmarkUndo);
}
}
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index d34282419a..b191e8cf67 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -790,7 +790,8 @@ void ex_retab(exarg_T *eap)
/* len is actual number of white characters used */
len = num_spaces + num_tabs;
old_len = (long)STRLEN(ptr);
- new_line = xmalloc(old_len - col + start_col + len + 1);
+ long new_len = old_len - col + start_col + len + 1;
+ new_line = xmalloc(new_len);
if (start_col > 0)
memmove(new_line, ptr, (size_t)start_col);
@@ -803,6 +804,8 @@ void ex_retab(exarg_T *eap)
if (ml_replace(lnum, new_line, false) == OK) {
// "new_line" may have been copied
new_line = curbuf->b_ml.ml_line_ptr;
+ extmark_splice_cols(curbuf, lnum - 1, 0, (colnr_T)old_len,
+ (colnr_T)new_len - 1, kExtmarkUndo);
}
if (first_line == 0) {
first_line = lnum;