aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/highlight_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-23 16:15:04 +0800
committerGitHub <noreply@github.com>2023-02-23 16:15:04 +0800
commit524e1a06432ed7a88c1e183d81812dd48dc18cfb (patch)
tree3964961f56feece9b1e306966fb9f17e166259f2 /test/functional/api/highlight_spec.lua
parentd422fc8274e757e95329e60b4e6daec59363ba19 (diff)
downloadrneovim-524e1a06432ed7a88c1e183d81812dd48dc18cfb.tar.gz
rneovim-524e1a06432ed7a88c1e183d81812dd48dc18cfb.tar.bz2
rneovim-524e1a06432ed7a88c1e183d81812dd48dc18cfb.zip
fix(highlight): avoid ORing underline flags (#22372)
When combining attributes use the one that takes priority. For :highlight command use the last one specified. For API use a hard-coded order same as the order in docs.
Diffstat (limited to 'test/functional/api/highlight_spec.lua')
-rw-r--r--test/functional/api/highlight_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua
index e1b3562329..eb7d0f7b47 100644
--- a/test/functional/api/highlight_spec.lua
+++ b/test/functional/api/highlight_spec.lua
@@ -278,6 +278,20 @@ describe("API: set highlight", function()
eq(highlight3_result_cterm, meths.get_hl_by_name('Test_hl', false))
end)
+ it("only allows one underline attribute #22371", function()
+ local ns = get_ns()
+ meths.set_hl(ns, 'Test_hl', {
+ underdouble = true,
+ underdotted = true,
+ cterm = {
+ underline = true,
+ undercurl = true,
+ },
+ })
+ eq({ undercurl = true }, meths.get_hl_by_name('Test_hl', false))
+ eq({ underdotted = true }, meths.get_hl_by_name('Test_hl', true))
+ end)
+
it("can set a highlight in the global namespace", function()
meths.set_hl(0, 'Test_hl', highlight2_config)
eq('Test_hl xxx cterm=underline,reverse ctermfg=8 ctermbg=15 gui=underline,reverse',