Merge #9625 from janlazo/vim-8.1.0945

This commit is contained in:
Justin M. Keyes 2019-02-18 10:37:56 +01:00 committed by GitHub
commit 9cf600e702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 11 deletions

View File

@ -772,7 +772,7 @@ static int get_equi_class(char_u **pp)
int l = 1; int l = 1;
char_u *p = *pp; char_u *p = *pp;
if (p[1] == '=') { if (p[1] == '=' && p[2] != NUL) {
l = (*mb_ptr2len)(p + 2); l = (*mb_ptr2len)(p + 2);
if (p[l + 2] == '=' && p[l + 3] == ']') { if (p[l + 2] == '=' && p[l + 3] == ']') {
c = utf_ptr2char(p + 2); c = utf_ptr2char(p + 2);
@ -1103,7 +1103,7 @@ static int get_coll_element(char_u **pp)
int l = 1; int l = 1;
char_u *p = *pp; char_u *p = *pp;
if (p[0] != NUL && p[1] == '.') { if (p[0] != NUL && p[1] == '.' && p[2] != NUL) {
l = utfc_ptr2len(p + 2); l = utfc_ptr2len(p + 2);
if (p[l + 2] == '.' && p[l + 3] == ']') { if (p[l + 2] == '.' && p[l + 3] == ']') {
c = utf_ptr2char(p + 2); c = utf_ptr2char(p + 2);

View File

@ -1691,15 +1691,16 @@ 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] == '-')
else if (*regparse == 'd' ? NL : NFA_NEWL;
|| *regparse == 'o' } else if (*regparse == 'd'
|| *regparse == 'x' || *regparse == 'o'
|| *regparse == 'u' || *regparse == 'x'
|| *regparse == 'U' || *regparse == 'u'
) { || *regparse == 'U'
/* TODO(RE) This needs more testing */ ) {
// TODO(RE): This needs more testing
startc = coll_get_char(); startc = coll_get_char();
got_coll_char = true; got_coll_char = true;
MB_PTR_BACK(old_regparse, regparse); MB_PTR_BACK(old_regparse, regparse);

View File

@ -30,3 +30,20 @@ func Test_equivalence_re2()
set re=2 set re=2
call s:equivalence_test() call s:equivalence_test()
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
func Test_get_equi_class()
new
" Incomplete equivalence class caused invalid memory access
s/^/[[=
call assert_equal(1, search(getline(1)))
s/.*/[[.
call assert_equal(1, search(getline(1)))
endfunc