Skip to content

Commit

Permalink
vim-patch:8.0.0133 (#7107)
Browse files Browse the repository at this point in the history
Problem:    "2;'(" causes ml_get errors in an empty buffer.  (Dominique Pelle)
Solution:   Check the cursor line earlier.

vim/vim@fe38b49
  • Loading branch information
ckelsel authored and justinmk committed Aug 2, 2017
1 parent 27356de commit eb40b7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/nvim/ex_docmd.c
Expand Up @@ -1665,11 +1665,15 @@ static char_u * do_one_cmd(char_u **cmdlinep,
ea.addr_count++;

if (*ea.cmd == ';') {
if (!ea.skip)
if (!ea.skip) {
curwin->w_cursor.lnum = ea.line2;
} else if (*ea.cmd != ',')
// Don't leave the cursor on an illegal line (caused by ';')
check_cursor_lnum();
}
} else if (*ea.cmd != ',') {
break;
++ea.cmd;
}
ea.cmd++;
}

/* One address given: set start and end lines */
Expand All @@ -1680,9 +1684,6 @@ static char_u * do_one_cmd(char_u **cmdlinep,
ea.addr_count = 0;
}

/* Don't leave the cursor on an illegal line (caused by ';') */
check_cursor_lnum();

/*
* 5. Parse the command.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/nvim/testdir/test_cmdline.vim
Expand Up @@ -232,3 +232,10 @@ func Test_paste_in_cmdline()
call assert_equal('"aaa a;b-c*d bbb', @:)
bwipe!
endfunc

func Test_illegal_address()
new
2;'(
2;')
quit
endfunc
2 changes: 1 addition & 1 deletion src/nvim/version.c
Expand Up @@ -596,7 +596,7 @@ static const int included_patches[] = {
136,
135,
// 134,
// 133,
133,
// 132,
// 131,
// 130 NA
Expand Down

0 comments on commit eb40b7e

Please sign in to comment.