vim-patch:8.2.0083: text properties wrong when tabs and spaces are exchanged

Problem:    Text properties wrong when tabs and spaces are exchanged.
Solution:   Take text properties into account. (Nobuhiro Takasaki,
            closes vim/vim#5427)

5cb0b93d52

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2024-06-02 14:58:12 +08:00
parent 05435a915a
commit 4374ec83cd

View File

@ -4421,18 +4421,21 @@ static bool ins_tab(void)
// Delete following spaces.
int i = cursor->col - fpos.col;
if (i > 0) {
STRMOVE(ptr, ptr + i);
if (!(State & VREPLACE_FLAG)) {
memmove(ptr, ptr + i, (size_t)(curbuf->b_ml.ml_line_len - i
- (ptr - curbuf->b_ml.ml_line_ptr)));
curbuf->b_ml.ml_line_len -= i;
inserted_bytes(fpos.lnum, change_col,
cursor->col - change_col, fpos.col - change_col);
} else {
STRMOVE(ptr, ptr + i);
}
// correct replace stack.
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) {
for (temp = i; --temp >= 0;) {
replace_join(repl_off);
}
}
if (!(State & VREPLACE_FLAG)) {
curbuf->b_ml.ml_line_len -= i;
inserted_bytes(fpos.lnum, change_col,
cursor->col - change_col, fpos.col - change_col);
}
}
cursor->col -= i;