diff options
| author | glepnir <glephunter@gmail.com> | 2026-04-12 20:38:35 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-12 08:38:35 -0400 |
| commit | 49086862fc521c29dd8fb7c96cc23a267f1bf397 (patch) | |
| tree | 40f1f7df7f7a0c437ce25fede51e5f2cd0776063 /runtime/lua/vim/_meta/api.lua | |
| parent | 2f6c560002f11c5d6e60b1eeeb6896dbc50d48bd (diff) | |
| download | rneovim-49086862fc521c29dd8fb7c96cc23a267f1bf397.tar.gz rneovim-49086862fc521c29dd8fb7c96cc23a267f1bf397.tar.bz2 rneovim-49086862fc521c29dd8fb7c96cc23a267f1bf397.zip | |
fix(api): nvim_get_hl drops groups defined with link_global #38492
Problem: hlgroup2dict passes &ns_id to ns_get_hl twice. The first call
(link=true) sets *ns_hl = 0 when link_global is set, so the second call
and the sg_cleared guard both see ns_id == 0 and bail out. The group is
silently dropped from the result.
Solution: use a temporary copy of ns_id for each ns_get_hl call so the
original value is preserved.
Diffstat (limited to 'runtime/lua/vim/_meta/api.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/api.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 9cc40a30ba..e9754ed8b5 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -2225,29 +2225,29 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- `nvim_set_hl_ns()` or `nvim_win_set_hl_ns()` to activate them. --- @param name string Highlight group name, e.g. "ErrorMsg" --- @param val vim.api.keyset.highlight Highlight definition map, accepts the following keys: +--- - altfont: boolean --- - bg: color name or "#RRGGBB", see note. --- - bg_indexed: boolean (default false) If true, bg is a terminal palette index (0-255). --- - blend: integer between 0 and 100 +--- - blink: boolean +--- - bold: boolean +--- - conceal: boolean Concealment at the UI level (terminal SGR), unrelated to `:syn-conceal`. --- - cterm: cterm attribute map, like `highlight-args`. If not set, cterm attributes --- will match those from the attribute map documented above. --- - ctermbg: Sets background of cterm color `ctermbg` --- - ctermfg: Sets foreground of cterm color `ctermfg` --- - default: boolean Don't override existing definition `:hi-default` +--- - dim: boolean --- - fg: color name or "#RRGGBB", see note. --- - fg_indexed: boolean (default false) If true, fg is a terminal palette index (0-255). --- - force: if true force update the highlight group when it exists. ---- - link: Name of highlight group to link to. `:hi-link` ---- - sp: color name or "#RRGGBB" ---- - update: boolean (default false) Update specified attributes only, leave others unchanged. ---- - altfont: boolean ---- - blink: boolean ---- - bold: boolean ---- - conceal: boolean Concealment at the UI level (terminal SGR), unrelated to `:syn-conceal`. ---- - dim: boolean --- - italic: boolean +--- - link: Name of highlight group to link to. `:hi-link` +--- - link_global: Like "link", but always resolved in the global (ns=0) namespace. --- - nocombine: boolean --- - overline: boolean --- - reverse: boolean +--- - sp: color name or "#RRGGBB" --- - standout: boolean --- - strikethrough: boolean --- - undercurl: boolean @@ -2255,6 +2255,7 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- - underdotted: boolean --- - underdouble: boolean --- - underline: boolean +--- - update: boolean (default false) Update specified attributes only, leave others unchanged. function vim.api.nvim_set_hl(ns_id, name, val) end --- Set active namespace for highlights defined with `nvim_set_hl()`. This can be set for |