diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-11-22 10:13:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 10:13:10 +0100 |
commit | 2e722da44d3807698374043ecdd9952bd0772a40 (patch) | |
tree | f37567ea2fe07b6e640386bec469bf8e5d9166d1 /src/nvim/api/deprecated.c | |
parent | 8c6b0a5f21d5f0cf3781ef2b6fdbb306d5604a02 (diff) | |
parent | 0b38fe4dbb77c15ae6f5779174855acab25fc86c (diff) | |
download | rneovim-2e722da44d3807698374043ecdd9952bd0772a40.tar.gz rneovim-2e722da44d3807698374043ecdd9952bd0772a40.tar.bz2 rneovim-2e722da44d3807698374043ecdd9952bd0772a40.zip |
Merge pull request #25826 from bfredl/art_deco
refactor(decorations): break up Decoration struct into smaller pieces
Diffstat (limited to 'src/nvim/api/deprecated.c')
-rw-r--r-- | src/nvim/api/deprecated.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 849897b529..b4aa6fe99e 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -154,21 +154,25 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A return 0; } - Decoration *existing = decor_find_virttext(buf, (int)line, ns_id); + DecorVirtText *existing = decor_find_virttext(buf, (int)line, ns_id); if (existing) { - clear_virttext(&existing->virt_text); - existing->virt_text = virt_text; - existing->virt_text_width = width; + clear_virttext(&existing->data.virt_text); + existing->data.virt_text = virt_text; + existing->width = width; return src_id; } - Decoration decor = DECORATION_INIT; - decor.virt_text = virt_text; - decor.virt_text_width = width; - decor.priority = 0; + DecorVirtText *vt = xmalloc(sizeof *vt); + *vt = (DecorVirtText)DECOR_VIRT_TEXT_INIT; + vt->data.virt_text = virt_text; + vt->width = width; + vt->priority = 0; - extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, false, false, false, NULL); + DecorInline decor = { .ext = true, .data.ext.vt = vt, .data.ext.sh_idx = DECOR_ID_INVALID }; + + extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, decor, 0, true, + false, false, false, NULL); return src_id; } |