aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/extmark.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-20 08:20:19 +0800
committerGitHub <noreply@github.com>2024-08-20 08:20:19 +0800
commita8fbe1d409e08c68b05bc26b096486020ae3162b (patch)
tree0f1a85498382cb7d3674ca33701f6fc156a581f5 /src/nvim/api/extmark.c
parent1d11808bfd2879bf278cd05a7095a6634fa5afec (diff)
downloadrneovim-a8fbe1d409e08c68b05bc26b096486020ae3162b.tar.gz
rneovim-a8fbe1d409e08c68b05bc26b096486020ae3162b.tar.bz2
rneovim-a8fbe1d409e08c68b05bc26b096486020ae3162b.zip
fix(decor): don't use separate DecorSignHighlight for url (#30096)
Diffstat (limited to 'src/nvim/api/extmark.c')
-rw-r--r--src/nvim/api/extmark.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index e30ec9a2ca..1673519479 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -687,6 +687,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
if (HAS_KEY(opts, set_extmark, url)) {
url = string_to_cstr(opts->url);
+ has_hl = true;
}
if (opts->ui_watched) {
@@ -758,13 +759,9 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
if (kv_size(virt_lines.data.virt_lines)) {
decor_range_add_virt(&decor_state, r, c, line2, col2, decor_put_vt(virt_lines, NULL), true);
}
- if (url != NULL) {
- DecorSignHighlight sh = DECOR_SIGN_HIGHLIGHT_INIT;
- sh.url = url;
- decor_range_add_sh(&decor_state, r, c, line2, col2, &sh, true, 0, 0);
- }
if (has_hl) {
DecorSignHighlight sh = decor_sh_from_inline(hl);
+ sh.url = url;
decor_range_add_sh(&decor_state, r, c, line2, col2, &sh, true, (uint32_t)ns_id, id);
}
} else {
@@ -788,12 +785,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
}
uint32_t decor_indexed = DECOR_ID_INVALID;
- if (url != NULL) {
- DecorSignHighlight sh = DECOR_SIGN_HIGHLIGHT_INIT;
- sh.url = url;
- sh.next = decor_indexed;
- decor_indexed = decor_put_sh(sh);
- }
+
if (sign.flags & kSHIsSign) {
sign.next = decor_indexed;
decor_indexed = decor_put_sh(sign);
@@ -806,9 +798,11 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
}
DecorInline decor = DECOR_INLINE_INIT;
- if (decor_alloc || decor_indexed != DECOR_ID_INVALID || schar_high(hl.conceal_char)) {
+ if (decor_alloc || decor_indexed != DECOR_ID_INVALID || url != NULL
+ || schar_high(hl.conceal_char)) {
if (has_hl) {
DecorSignHighlight sh = decor_sh_from_inline(hl);
+ sh.url = url;
sh.next = decor_indexed;
decor_indexed = decor_put_sh(sh);
}