aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 19:03:25 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-02-17 19:11:16 -0500
commit55821948cfb553bcf8bbb23f77a0f43070b4fdb0 (patch)
treee58a88718d2779d81269619069061a07282b6382
parent6b827bb6646c213b8ad5ee6c1c87dcfd84f4bc29 (diff)
downloadrneovim-55821948cfb553bcf8bbb23f77a0f43070b4fdb0.tar.gz
rneovim-55821948cfb553bcf8bbb23f77a0f43070b4fdb0.tar.bz2
rneovim-55821948cfb553bcf8bbb23f77a0f43070b4fdb0.zip
vim-patch:8.1.0945: internal error when using pattern with NL in the range
Problem: Internal error when using pattern with NL in the range. Solution: Use an actual newline for the range. (closes vim/vim#3989) Also fix error message. (Dominique Pelle) https://github.com/vim/vim/commit/a5483448cba6997517003a22a8029f0de1007d0e
-rw-r--r--src/nvim/regexp_nfa.c3
-rw-r--r--src/nvim/testdir/test_regexp_latin.vim8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 08ef7da9c1..4e5f855e7f 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1692,7 +1692,8 @@ collection:
MB_PTR_ADV(regparse);
if (*regparse == 'n')
- startc = reg_string ? NL : NFA_NEWL;
+ startc = (reg_string || emit_range || regparse[1] == '-')
+ ? NL : NFA_NEWL;
else if (*regparse == 'd'
|| *regparse == 'o'
|| *regparse == 'x'
diff --git a/src/nvim/testdir/test_regexp_latin.vim b/src/nvim/testdir/test_regexp_latin.vim
index 8528412806..e31bb08b19 100644
--- a/src/nvim/testdir/test_regexp_latin.vim
+++ b/src/nvim/testdir/test_regexp_latin.vim
@@ -30,3 +30,11 @@ func Test_equivalence_re2()
set re=2
call s:equivalence_test()
endfunc
+
+func Test_range_with_newline()
+ new
+ call setline(1, "a")
+ call assert_equal(0, search("[ -*\\n- ]"))
+ call assert_equal(0, search("[ -*\\t-\\n]"))
+ bwipe!
+endfunc