diff options
author | watiko <service@mail.watiko.net> | 2016-01-14 13:56:41 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-01 03:47:09 +0900 |
commit | 3a94e06abbcc0dfff658b626891ec308f7582180 (patch) | |
tree | 44f0097b4b22535a240e9299935025ff2b0c3180 /src/nvim/ops.c | |
parent | 40149a9dbf475ad1d0dec9a9494a32c26a6536ce (diff) | |
download | rneovim-3a94e06abbcc0dfff658b626891ec308f7582180.tar.gz rneovim-3a94e06abbcc0dfff658b626891ec308f7582180.tar.bz2 rneovim-3a94e06abbcc0dfff658b626891ec308f7582180.zip |
vim-patch:7.4.1085
Problem: The CTRL-A and CTRL-X commands do not update the '[ and '] marks.
Solution: (Yukihiro Nakadaira)
https://github.com/vim/vim/commit/a52dfaed104183c1fa2a3b6e4430b23d86bcbece
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 71c4fa629e..8887b3ae91 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4217,6 +4217,8 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) bool did_change = false; pos_T t = curwin->w_cursor; int maxlen = 0; + pos_T startpos; + pos_T endpos; dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" @@ -4393,9 +4395,13 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) } } curwin->w_cursor.col = col; + if (!did_change) { + startpos = curwin->w_cursor; + } did_change = true; (void)del_char(false); ins_char(firstdigit); + endpos = curwin->w_cursor; curwin->w_cursor.col = col; } else { if (col > 0 && ptr[col - 1] == '-' && !visual) { @@ -4477,6 +4483,9 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) // Delete the old number. curwin->w_cursor.col = col; + if (!did_change) { + startpos = curwin->w_cursor; + } did_change = true; todel = length; c = gchar_cursor(); @@ -4559,6 +4568,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) STRCAT(buf1, buf2); ins_str(buf1); // insert the new number xfree(buf1); + endpos = curwin->w_cursor; if (lnum < lnume) { curwin->w_cursor.col = t.col; } else if (did_change && curwin->w_cursor.col) { @@ -4586,6 +4596,14 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) // cursor at the top of the selection curwin->w_cursor = VIsual; } + if (did_change) { + // set the '[ and '] marks + curbuf->b_op_start = startpos; + curbuf->b_op_end = endpos; + if (curbuf->b_op_end.col > 0) { + curbuf->b_op_end.col--; + } + } return OK; } |