aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-03-06 22:56:41 +0300
committerKirill Chibisov <contact@kchibisov.com>2022-03-06 23:51:25 +0300
commit96bb1784a61daec4535edf291303225aa1fa01e0 (patch)
treeab7a655925d63fc22b515592f425d85affb8a9e7
parent3800615da9eaf9e8b26d9040c882c74084d688e4 (diff)
downloadrneovim-96bb1784a61daec4535edf291303225aa1fa01e0.tar.gz
rneovim-96bb1784a61daec4535edf291303225aa1fa01e0.tar.bz2
rneovim-96bb1784a61daec4535edf291303225aa1fa01e0.zip
fix(api): highlight attribute for underline
This commit fixes regression introduced in c365de1 when checking for highlight attribute for underline was returning '0' when it was present Fixes #17624.
-rw-r--r--src/nvim/eval/funcs.c2
-rw-r--r--test/functional/terminal/highlight_spec.lua15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index df1889b12d..7da4fe62e8 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -11411,7 +11411,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
case 'u': {
const size_t len = STRLEN(what);
if (len <= 5 || (TOLOWER_ASC(what[5]) == 'l' && len <= 9)) { // underline
- p = highlight_has_attr(id, HL_UNDERCURL, modec);
+ p = highlight_has_attr(id, HL_UNDERLINE, modec);
} else if (TOLOWER_ASC(what[5]) == 'c') { // undercurl
p = highlight_has_attr(id, HL_UNDERCURL, modec);
} else if (len > 9 && TOLOWER_ASC(what[9]) == 'l') { // underlineline
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index ebbae1df14..ab4b4e9147 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -305,10 +305,17 @@ describe('synIDattr()', function()
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
end)
- it('returns "1" if group has "strikethrough" attribute', function()
- eq('', eval('synIDattr(hlID("Normal"), "strikethrough")'))
- eq('1', eval('synIDattr(hlID("Keyword"), "strikethrough")'))
- eq('1', eval('synIDattr(hlID("Keyword"), "strikethrough", "gui")'))
+ it('returns "1" if group has given highlight attribute', function()
+ local hl_attrs = {
+ 'underline', 'underlineline', 'undercurl', 'underdot', 'underdash', 'strikethrough'
+ }
+ for _,hl_attr in ipairs(hl_attrs) do
+ local context = 'using ' .. hl_attr .. ' attr'
+ command('highlight Keyword cterm=' .. hl_attr .. ' gui=' .. hl_attr)
+ eq('', eval('synIDattr(hlID("Normal"), "'.. hl_attr .. '")'), context)
+ eq('1', eval('synIDattr(hlID("Keyword"), "' .. hl_attr .. '")'), context)
+ eq('1', eval('synIDattr(hlID("Keyword"), "' .. hl_attr .. '", "gui")'), context)
+ end
end)
end)