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

View File

@ -1691,15 +1691,16 @@ collection:
) {
MB_PTR_ADV(regparse);
if (*regparse == 'n')
startc = reg_string ? NL : NFA_NEWL;
else if (*regparse == 'd'
|| *regparse == 'o'
|| *regparse == 'x'
|| *regparse == 'u'
|| *regparse == 'U'
) {
/* TODO(RE) This needs more testing */
if (*regparse == 'n') {
startc = (reg_string || emit_range || regparse[1] == '-')
? NL : NFA_NEWL;
} else if (*regparse == 'd'
|| *regparse == 'o'
|| *regparse == 'x'
|| *regparse == 'u'
|| *regparse == 'U'
) {
// TODO(RE): This needs more testing
startc = coll_get_char();
got_coll_char = true;
MB_PTR_BACK(old_regparse, regparse);

View File

@ -30,3 +30,20 @@ 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
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