diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-06-22 22:40:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 22:40:33 +0200 |
commit | 8f30753aa1398eadecf1bd9f6dc71251218b9b2d (patch) | |
tree | 9572999548caca5b79f2c028e88a5cbc1db97319 /src/nvim/ops.c | |
parent | 21453e8f09b72751d396858b9ea86c0584fd6c89 (diff) | |
parent | b198225361dd87161c494627dfebb3d9ffd6cf5a (diff) | |
download | rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.tar.gz rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.tar.bz2 rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.zip |
Merge pull request #12455 from janlazo/vim-8.0.1554
[RDY]vim-patch:8.0.1554,8.1.1977,8.2.{927,930,932,938,954,963,964,966,980,983,998,999}
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index eb32a1dd9b..e905029dae 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4671,17 +4671,23 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) int maxlen = 0; pos_T startpos; pos_T endpos; + colnr_T save_coladd = 0; dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" dobin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin" doalp = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha" + if (virtual_active()) { + save_coladd = pos->coladd; + pos->coladd = 0; + } + curwin->w_cursor = *pos; ptr = ml_get(pos->lnum); col = pos->col; - if (*ptr == NUL) { + if (*ptr == NUL || col + !!save_coladd >= (int)STRLEN(ptr)) { goto theend; } @@ -4976,6 +4982,8 @@ theend: curwin->w_cursor = save_cursor; } else if (did_change) { curwin->w_set_curswant = true; + } else if (virtual_active()) { + curwin->w_cursor.coladd = save_coladd; } return did_change; |