diff options
author | watiko <service@mail.watiko.net> | 2016-01-14 19:53:14 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-01 03:43:36 +0900 |
commit | d050d6390d316193277bc9ce8ea4aa230e38173f (patch) | |
tree | ab75e87337e43758c47cef23f007a4f5cb2d2a7b /src | |
parent | b3dbc9d90b4e4f3ec627ab2a17238281097e330c (diff) | |
download | rneovim-d050d6390d316193277bc9ce8ea4aa230e38173f.tar.gz rneovim-d050d6390d316193277bc9ce8ea4aa230e38173f.tar.bz2 rneovim-d050d6390d316193277bc9ce8ea4aa230e38173f.zip |
vim-patch:7.4.779
Problem: Using CTRL-A in a line without a number moves the cursor. May
cause a crash when at the start of the line. (Urtica Dioica)
Solution: Do not move the cursor if no number was changed.
https://github.com/vim/vim/commit/3ec326198029d5a59413b3b8b33dbc9c06c4f28b
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 7 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 943dd7a2da..f85246344c 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4231,6 +4231,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) int lnum = curwin->w_cursor.lnum; int lnume = curwin->w_cursor.lnum; int startcol; + bool did_change = false; dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" @@ -4383,6 +4384,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) } } curwin->w_cursor.col = col; + did_change = true; (void)del_char(false); ins_char(firstdigit); } else { @@ -4443,6 +4445,7 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) // Delete the old number. curwin->w_cursor.col = col; + did_change = true; todel = length; c = gchar_cursor(); @@ -4541,7 +4544,9 @@ int do_addsub(int command, linenr_T Prenum1, bool g_cmd) ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, true); RLADDSUBFIX(ptr); } - curwin->w_cursor.col--; + if (did_change && curwin->w_cursor.col > 0) { + curwin->w_cursor.col--; + } return OK; } diff --git a/src/nvim/version.c b/src/nvim/version.c index 84a15bec0a..3c15869ea0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -355,7 +355,7 @@ static int included_patches[] = { // 782, 781, // 780 NA - // 779, + 779, 778, // 777 NA 776, |