diff options
author | chentau <tchen1998@gmail.com> | 2021-04-02 14:01:13 -0700 |
---|---|---|
committer | chentau <tchen1998@gmail.com> | 2021-04-02 16:21:46 -0700 |
commit | 7602c560508de35c9e211ecc732fda0ff3c06923 (patch) | |
tree | aa115e827ecf9db4f50ae1889a1a356ec4a91144 /src/nvim/ex_cmds.c | |
parent | dde89730b453fd2b84860e58bb8893c92417128b (diff) | |
download | rneovim-7602c560508de35c9e211ecc732fda0ff3c06923.tar.gz rneovim-7602c560508de35c9e211ecc732fda0ff3c06923.tar.bz2 rneovim-7602c560508de35c9e211ecc732fda0ff3c06923.zip |
extmark: fixes for noexpandtab and retab
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |