aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/option.c3
-rw-r--r--test/functional/ui/highlight_spec.lua28
-rw-r--r--test/old/testdir/gen_opt_test.vim15
3 files changed, 31 insertions, 15 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 2e6d317778..89753f7cf8 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1853,6 +1853,9 @@ bool parse_winhl_opt(win_T *wp)
return false;
}
int hl_id_link = nlen ? syn_check_group(p, nlen) : 0;
+ if (hl_id_link == 0) {
+ return false;
+ }
HlAttrs attrs = HLATTRS_INIT;
attrs.rgb_ae_attr |= HL_GLOBAL;
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 47b923c8e2..c989418409 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -2426,16 +2426,24 @@ describe('highlight namespaces', function()
end)
it('winhl does not accept invalid value #24586', function()
- local res = exec_lua([[
- local curwin = vim.api.nvim_get_current_win()
- vim.api.nvim_command("set winhl=Normal:Visual")
- local _, msg = pcall(vim.api.nvim_command,"set winhl='Normal:Wrong'")
- return { msg, vim.wo[curwin].winhl }
- ]])
- eq({
- 'Vim(set):E5248: Invalid character in group name',
- 'Normal:Visual',
- }, res)
+ command('set winhl=Normal:Visual')
+ for _, cmd in ipairs({
+ [[set winhl='Normal:Wrong']],
+ [[set winhl=Normal:Wrong']],
+ [[set winhl='Normal:Wrong]],
+ }) do
+ local res = exec_lua(
+ [[
+ local _, msg = pcall(vim.api.nvim_command, ...)
+ return { msg, vim.wo.winhl }
+ ]],
+ cmd
+ )
+ eq({
+ 'Vim(set):E5248: Invalid character in group name',
+ 'Normal:Visual',
+ }, res)
+ end
end)
it('Normal in set_hl #25474', function()
diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim
index 27e709b19d..f64798f8dd 100644
--- a/test/old/testdir/gen_opt_test.vim
+++ b/test/old/testdir/gen_opt_test.vim
@@ -84,14 +84,19 @@ let test_values = {
"\ Nvim-only options
\ 'channel': [[], []],
\ 'inccommand': [['', 'nosplit', 'split'], ['xxx']],
- \ 'mousescroll': [['ver:1', 'hor:2', 'ver:1,hor:2', 'hor:1,ver:2'], ['xxx']],
+ \ 'mousescroll': [['ver:1', 'hor:2', 'ver:1,hor:2', 'hor:1,ver:2'],
+ \ ['xxx', 'ver:1,xxx', 'hor:2,xxx']],
\ 'redrawdebug': [[''], ['xxx']],
\ 'shada': [['', '''50', '"30'], ['xxx']],
- \ 'termpastefilter': [['BS', 'HT', 'FF', 'ESC', 'DEL', 'C0', 'C1', 'C0,C1'], ['xxx']],
- \ 'winhighlight': [['', 'Visual:Search'], ['xxx']],
+ \ 'termpastefilter': [['BS', 'HT', 'FF', 'ESC', 'DEL', 'C0', 'C1', 'C0,C1'],
+ \ ['xxx', 'C0,C1,xxx']],
+ \ 'winhighlight': [['', 'a:b', 'a:', 'a:b,c:d'],
+ \ ['a', ':', ':b', 'a:b:c', 'a:/', '/:b', ',', 'a:b,,', 'a:b,c']],
\
"\ Options for which Nvim has different allowed values
- \ 'backspace': [[2, '', 'eol', 'eol,start', 'indent,eol,nostop'], ['4', 'xxx']],
+ \ 'backspace': [[2, '', 'indent', 'eol', 'start', 'nostop',
+ \ 'eol,start', 'indent,eol,nostop'],
+ \ [-1, 4, 'xxx']],
\ 'buftype': [['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help',
\ 'prompt'],
\ ['xxx', 'help,nofile']],
@@ -105,7 +110,7 @@ let test_values = {
\ 'highlight': [[&highlight], []],
\ 'iminsert': [[0, 1], [-1, 2, 3, 999]],
\ 'imsearch': [[-1, 0, 1], [-2, 2, 3, 999]],
- \ 'signcolumn': [['auto', 'no'], ['xxx', 'no,yes']],
+ \ 'signcolumn': [['auto', 'no', 'yes', 'number'], ['', 'xxx', 'no,yes']],
\ 'writedelay': [[0, 100], [-1, '']],
\
"\ boolean options