To: vim_dev@googlegroups.com Subject: Patch 8.1.0945 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0945 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) Files: src/regexp_nfa.c, src/testdir/test_regexp_latin.vim *** ../vim-8.1.0944/src/regexp_nfa.c 2019-02-14 20:55:05.983776869 +0100 --- src/regexp_nfa.c 2019-02-17 20:11:05.243105933 +0100 *************** *** 245,251 **** 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_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %ld"); // Variables only used in nfa_regcomp() and descendants. static int nfa_re_flags; // re_flags passed to nfa_regcomp() --- 245,251 ---- 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_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %d"); // Variables only used in nfa_regcomp() and descendants. static int nfa_re_flags; // re_flags passed to nfa_regcomp() *************** *** 1785,1791 **** MB_PTR_ADV(regparse); if (*regparse == 'n') ! startc = reg_string ? NL : NFA_NEWL; else if (*regparse == 'd' || *regparse == 'o' --- 1785,1792 ---- MB_PTR_ADV(regparse); if (*regparse == 'n') ! startc = (reg_string || emit_range ! || regparse[1] == '-') ? NL : NFA_NEWL; else if (*regparse == 'd' || *regparse == 'o' *** ../vim-8.1.0944/src/testdir/test_regexp_latin.vim 2019-02-17 13:53:31.600227794 +0100 --- src/testdir/test_regexp_latin.vim 2019-02-17 20:10:57.103144259 +0100 *************** *** 122,124 **** --- 122,132 ---- bwipe! set re=0 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 *** ../vim-8.1.0944/src/version.c 2019-02-17 19:12:17.646329910 +0100 --- src/version.c 2019-02-17 20:11:44.602919414 +0100 *************** *** 781,782 **** --- 781,784 ---- { /* Add new patch number below this line */ + /**/ + 945, /**/ -- An easy way to determine if you have enough teamwork to be doomed is simply to measure how long it takes from the time you decide to go to lunch together until the time you actually eat. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///