diff options
author | Sindre T. Strøm <sindrets@gmail.com> | 2023-03-31 12:52:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 12:52:53 +0200 |
commit | b34097fe6d2ea5c84bcec65a834a430d9f58eb64 (patch) | |
tree | 5437aa065dab04d1772ab15573ae47be584b778e /test/functional/api/highlight_spec.lua | |
parent | ed10e4ef60c63d924b9969abdf77adaad506b676 (diff) | |
download | rneovim-b34097fe6d2ea5c84bcec65a834a430d9f58eb64.tar.gz rneovim-b34097fe6d2ea5c84bcec65a834a430d9f58eb64.tar.bz2 rneovim-b34097fe6d2ea5c84bcec65a834a430d9f58eb64.zip |
fix(api): return both link and attributes with nvim_get_hl (#22824)
Problem: No way to get the actual highlight attributes for a linked
group through |nvim_get_hl()| (not the attributes from the link target).
Solution: Return the actual attributes as well as the link target name.
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 65b13bebf7..a4bd574a56 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -561,4 +561,18 @@ describe('API: get highlight', function() eq({ link = 'String' }, meths.get_hl(0, { name = '@string' })) eq({ fg = 10937249 }, meths.get_hl(0, { name = '@string.cpp', link = false })) end) + + it('can get all attributes for a linked group', function() + command('hi Bar guifg=red') + command('hi Foo guifg=#00ff00 gui=bold,underline') + command('hi! link Foo Bar') + eq({ link = 'Bar', fg = tonumber('00ff00', 16), bold = true, underline = true }, meths.get_hl(0, { name = 'Foo', link = true })) + end) + + it('can set link as well as other attributes', function() + command('hi Bar guifg=red') + local hl = { link = 'Bar', fg = tonumber('00ff00', 16), bold = true, cterm = { bold = true } } + meths.set_hl(0, 'Foo', hl) + eq(hl, meths.get_hl(0, { name = 'Foo', link = true })) + end) end) |