aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-28 23:48:52 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-01-29 00:12:24 -0500
commit1376994f1556b51d6a4feaedc094ee2456db5d06 (patch)
tree836ddf9beab731ee4bf72cb914f115ebbe5ef139 /src/nvim
parentc77b679ecd142f42a307ce1d5a1974f9bbb47911 (diff)
downloadrneovim-1376994f1556b51d6a4feaedc094ee2456db5d06.tar.gz
rneovim-1376994f1556b51d6a4feaedc094ee2456db5d06.tar.bz2
rneovim-1376994f1556b51d6a4feaedc094ee2456db5d06.zip
vim-patch:8.2.2425: cursor on invalid line with range and :substitute
Problem: Cursor on invalid line with range and :substitute. Solution: Do not move the cursor when skipping commands. (closes vim/vim#3434) https://github.com/vim/vim/commit/df2c2988bbaecd28b0fbec8d64327b1bbb005e19 Cherry-pick Test_for_invalid() from patch v8.1.0736.
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/ex_cmds.c3
-rw-r--r--src/nvim/testdir/test_eval_stuff.vim11
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index a2487336f1..2da8c205c1 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3126,6 +3126,9 @@ static bool sub_joining_lines(exarg_T *eap, char_u *pat, char_u *sub,
|| *cmd == 'l'
|| *cmd == 'p'
|| *cmd == '#')))) {
+ if (eap->skip) {
+ return true;
+ }
curwin->w_cursor.lnum = eap->line1;
if (*cmd == 'l') {
eap->flags = EXFLAG_LIST;
diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim
index 061364fb73..ff50d53d86 100644
--- a/src/nvim/testdir/test_eval_stuff.vim
+++ b/src/nvim/testdir/test_eval_stuff.vim
@@ -22,6 +22,17 @@ func Test_E963()
call assert_equal(v_o, v:oldfiles)
endfunc
+func Test_for_invalid()
+ call assert_fails("for x in 99", 'E714:')
+ call assert_fails("for x in 'asdf'", 'E714:')
+ call assert_fails("for x in {'a': 9}", 'E714:')
+
+ if 0
+ /1/5/2/s/\n
+ endif
+ redraw
+endfunc
+
func Test_mkdir_p()
call mkdir('Xmkdir/nested', 'p')
call assert_true(isdirectory('Xmkdir/nested'))