mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
feat(match): allow hl group to be defined after :match command
This commit is contained in:
@@ -157,7 +157,10 @@ func Test_match_error()
|
||||
endfunc
|
||||
|
||||
func Test_matchadd_error()
|
||||
call assert_fails("call matchadd('GroupDoesNotExist', 'X')", 'E28:')
|
||||
call clearmatches()
|
||||
" Nvim: not an error anymore:
|
||||
call matchadd('GroupDoesNotExist', 'X')
|
||||
call assert_equal([{'group': 'GroupDoesNotExist', 'pattern': 'X', 'priority': 10, 'id': 13}], getmatches())
|
||||
call assert_fails("call matchadd('Search', '\\(')", 'E475:')
|
||||
call assert_fails("call matchadd('Search', 'XXX', 1, 123, 1)", 'E715:')
|
||||
call assert_fails("call matchadd('Error', 'XXX', 1, 3)", 'E798:')
|
||||
|
@@ -6534,8 +6534,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
if ((hlg_id = syn_name2id((const char_u *)grp)) == 0) {
|
||||
EMSG2(_(e_nogroup), grp);
|
||||
if ((hlg_id = syn_check_group((const char_u *)grp, strlen(grp))) == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (pat != NULL && (regprog = vim_regcomp((char_u *)pat, RE_MAGIC)) == NULL) {
|
||||
|
Reference in New Issue
Block a user