0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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 #3989)  Also fix
            error message.  (Dominique Pelle)
This commit is contained in:
Bram Moolenaar
2019-02-17 20:17:02 +01:00
parent c85c8fcb9f
commit a5483448cb
3 changed files with 13 additions and 2 deletions

View File

@@ -245,7 +245,7 @@ static int nfa_classcodes[] = {
static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely"); static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c"); static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %ld"); static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %d");
// Variables only used in nfa_regcomp() and descendants. // Variables only used in nfa_regcomp() and descendants.
static int nfa_re_flags; // re_flags passed to nfa_regcomp() static int nfa_re_flags; // re_flags passed to nfa_regcomp()
@@ -1785,7 +1785,8 @@ collection:
MB_PTR_ADV(regparse); MB_PTR_ADV(regparse);
if (*regparse == 'n') if (*regparse == 'n')
startc = reg_string ? NL : NFA_NEWL; startc = (reg_string || emit_range
|| regparse[1] == '-') ? NL : NFA_NEWL;
else else
if (*regparse == 'd' if (*regparse == 'd'
|| *regparse == 'o' || *regparse == 'o'

View File

@@ -122,3 +122,11 @@ func Test_rex_init()
bwipe! bwipe!
set re=0 set re=0
endfunc 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

View File

@@ -779,6 +779,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
945,
/**/ /**/
944, 944,
/**/ /**/