aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-11-29 11:12:25 +0100
committerGitHub <noreply@github.com>2023-11-29 11:12:25 +0100
commit584c6c25ccfc5d13ffa0a4bd6efa467beb3987fe (patch)
treeac852d82a59e79f61b5c614058c656b3dcddd26e
parent640680cccead28c28b1b789c254fc83d55979c08 (diff)
parenta0e9ef09d7af8274c754ca6c368ef4a6f7411510 (diff)
downloadrneovim-584c6c25ccfc5d13ffa0a4bd6efa467beb3987fe.tar.gz
rneovim-584c6c25ccfc5d13ffa0a4bd6efa467beb3987fe.tar.bz2
rneovim-584c6c25ccfc5d13ffa0a4bd6efa467beb3987fe.zip
Merge pull request #26292 from luukvbaal/decor
fix(decorations): do not apply sign highlight id as range attr id
-rw-r--r--src/nvim/api/extmark.c3
-rw-r--r--src/nvim/decoration.c6
-rw-r--r--test/functional/ui/decorations_spec.lua12
3 files changed, 16 insertions, 5 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index d9e41f2448..d71498d6ed 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -781,9 +781,6 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
DecorSignHighlight sh = decor_sh_from_inline(hl);
decor_range_add_sh(&decor_state, r, c, line2, col2, &sh, true, (uint32_t)ns_id, id);
}
- if (sign.flags & kSHIsSign) {
- decor_range_add_sh(&decor_state, r, c, line2, col2, &sign, true, (uint32_t)ns_id, id);
- }
} else {
if (opts->ephemeral) {
api_set_error(err, kErrorTypeException, "not yet implemented");
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index 15d2869c48..407b54d133 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -537,6 +537,10 @@ void decor_range_add_virt(DecorState *state, int start_row, int start_col, int e
void decor_range_add_sh(DecorState *state, int start_row, int start_col, int end_row, int end_col,
DecorSignHighlight *sh, bool owned, uint32_t ns, uint32_t mark_id)
{
+ if (sh->flags & kSHIsSign) {
+ return;
+ }
+
DecorRange range = {
.start_row = start_row, .start_col = start_col, .end_row = end_row, .end_col = end_col,
.kind = kDecorKindHighlight,
@@ -547,7 +551,7 @@ void decor_range_add_sh(DecorState *state, int start_row, int start_col, int end
.draw_col = -10,
};
- if (sh->hl_id || (sh->flags & (kSHIsSign | kSHConceal | kSHSpellOn | kSHSpellOff))) {
+ if (sh->hl_id || (sh->flags & (kSHConceal | kSHSpellOn | kSHSpellOff))) {
if (sh->hl_id) {
range.attr_id = syn_id2attr(sh->hl_id);
}
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 6d4937b0c0..e8fcfc46fc 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -2155,6 +2155,17 @@ describe('extmark decorations', function()
|
]]}
end)
+
+ it('works with both hl_group and sign_hl_group', function()
+ screen:try_resize(screen._width, 3)
+ insert('abcdefghijklmn')
+ meths.buf_set_extmark(0, ns, 0, 0, {sign_text='S', sign_hl_group='NonText', hl_group='Error', end_col=14})
+ screen:expect{grid=[[
+ {1:S }{4:abcdefghijklm^n} |
+ {1:~ }|
+ |
+ ]]}
+ end)
end)
describe('decorations: inline virtual text', function()
@@ -4966,7 +4977,6 @@ l5
|
]]}
end)
-
end)
describe('decorations: virt_text', function()