summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/api/highlight_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-20fix(api): expose fg_indexed/bg_indexed in nvim_get_hl #39210glepnir1
Problem: fg_indexed/bg_indexed were dropped from nvim_get_hl output due to a wrong short_keys guard. HL_FG_INDEXED also wasn't cleared in hl_blend_attrs, and HLATTRS_DICT_SIZE was too small. Solution: Remove the short_keys guard, clear HL_FG_INDEXED in hl_blend_attrs, bump HLATTRS_DICT_SIZE to 24, and clarify docs that these flags mean rgb is an approximation of the cterm palette index.
2026-04-17fix(lsp): limit number of created highlight groups (#39133)Evgeni Chasnovski1
* fix(api): allow silencing "Too many highlight groups" error Problem: Using Lua's `vim.api.nvim_set_hl(0, 'New', {...})` can fail if there are too many existing highlight groups. However, this error can not be silenced with `pcall`. Solution: Make it possible to silence in `nvim_set_hl` and `nvim_get_hl_id_by_name`. * fix(lsp): limit number of groups created by `document_color()` Problem: A file can contain many string colors that would be highlighted by an LSP server. If this number crosses 19999 (maximum number of allowed highlight groups), there are general issues with creating other highlight groups, which can break functionality outside of `vim.lsp.document_color`. Solution: Limit number of highlight groups that are created by `vim.lsp.document_color` to 10000 (half of allowed maximum). This is not a 100% solution (since there can exist more than 10000 other highlight groups), but explicitly checking number of groups is slow and 10000 should (hopefully) be enough for most use cases.
2026-04-12feat(api): nvim_set_hl can set "font" #37668glepnir1
Problem: Cannot set highlight group fonts via API, only via :highlight command. Solution: Add font parameter in nvim_set_hl().
2026-04-12fix(api): nvim_get_hl drops groups defined with link_global #38492glepnir1
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.
2026-04-11fix(highlight): preserve inherited colors when update=true breaks links #38750glepnir1
Problem: Breaking a link with update=true loses colors inherited from the linked group. Solution: Copy color indices from the linked group so inherited colors remain visible in :hi output.
2026-03-28docs: news #38464Justin M. Keyes1
2026-03-28fix(api): nvim_set_hl boolean false corrupts underline styles (#38504)glepnir1
Problem: setting one underline style to false clears bits belonging to another style. `{underdouble = true, underdashed = false}` results in undercurl because CHECK_FLAG_WITH_KEY does `m &= ~flag` which doesn't work for multi-bit encoded values sharing HL_UNDERLINE_MASK. Solution: use a local variable to derive the correct clear mask from the flag. Clear the whole HL_UNDERLINE_MASK field instead of individual bits, and only clear on false when the current style actually matches.
2026-03-25feat(api): nvim_set_hl{update:boolean} #37546glepnir1
Problem: nvim_set_hl always replaces all attributes. Solution: Add update field. When true, merge with existing attributes instead of replacing. Unspecified attributes are preserved. If highlight group doesn't exist, falls back to reset mode.
2026-03-16fix(api): use standard error messagesJustin M. Keyes1
2026-03-06fix(api): nvim_set_hl crashes when url= key is passedglepnir1
Problem: Calling nvim_set_hl() with url= crashes because it tries to free arena-owned string memory. Solution: Remove the bad free and return a validation error instead.
2026-02-20feat(highlight): support more SGR attributes #37901Riccardo Mazzarini1
Problem: TUI does not support several standard SGR text attributes: - dim/faint (SGR 2) - blink (SGR 5) - conceal (SGR 8) - overline (SGR 53) This means that when a program running in the embedded terminal emits one of these escape codes, we drop it and don't surface it to the outer terminal. Solution: - Add support for those attributes. - Also add corresponding flags to `nvim_set_hl` opts, so users can set these attributes in highlight groups. - refactor(highlight): widen `HlAttrFlags` from `int16_t` to `int32_t` Widen the `rgb_ae_attr` and `cterm_ae_attr` fields in HlAttrs from int16_t to int32_t to make room for new highlight attribute flags, since there was only one spare bit left. - The C flag is named HL_CONCEALED to avoid colliding with the existing HL_CONCEAL in syntax.h (which is a syntax group flag, not an SGR attribute). - Also note that libvterm doesn't currently support the dim and overline attributes, so e.g. `printf '\e[2mThis should be dim\n'` and `printf '\e[53mThis should have an overline\n'` are still not rendered correctly when run from the embedded terminal.
2026-02-15fix(highlight): setting 'winhl' doesn't work with global ns (#37868)zeertzjq1
Problem: Setting 'winhighlight' doesn't after setting global namespace using nvim_win_set_hl_ns(). Solution: Check if using another namespace when setting 'winhighlight' instead of disabling 'winhighlight' in nvim_win_set_hl_ns().
2026-02-10test: move deprecated highlight API tests #37801glepnir1
Problem: Tests for deprecated highlight API were mixed with current API tests. Solution: Move them to deprecated_spec.lua and update highlight_spec.lua to use nvim_get_hl.
2024-12-02fix(api): make `nvim_set_hl()` respect all `cterm` attributes (#31390)Evgeni Chasnovski1
2024-11-22fix(highlight): 'winhl' shouldn't take priority over API (#31288)zeertzjq1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: normalise nvim bridge functionsLewis Russell1
- remove helpers.cur*meths - remove helpers.nvim
2024-01-12test: typing for helpers.methsLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-12-02feat(highlight): update default color schemeEvgeni Chasnovski1
Problem: Default color scheme is suboptimal. Solution: Start using new color scheme. Introduce new `vim` color scheme for opt-in backward compatibility. ------ Main design ideas - Be "Neovim branded". - Be minimal for 256 colors with a bit more shades for true colors. - Be accessible through high enough contrast ratios. - Be suitable for dark and light backgrounds via exchange of dark and light palettes. ------ Palettes - Have dark and light variants. Implemented through exporeted `NvimDark*` and `NvimLight*` hex colors. - Palettes have 4 shades of grey for UI elements and 6 colors (red, yellow, green, cyan, blue, magenta). - Actual values are computed procedurally in Oklch color space based on a handful of hyperparameters. - Each color has a 256 colors variant with perceptually closest color. ------ Highlight groups Use: - Grey shades for general UI according to their design. - Bold text for keywords (`Statement` highlight group). This is an important choice to increase accessibility for people with color deficiencies, as it doesn't rely on actual color. - Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some minor text UI elements. - Cyan as main syntax color, i.e. for function usage (`Function` highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI elements. - Red to generally mean high user attention, i.e. errors; in particular for `ErrorMsg`, `DiffDelete`, `DiagnosticError`. - Yellow very sparingly only with true colors to mean mild user attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`. - Blue very sparingly only with true colors as `DiagnosticHint` and some additional important syntax group (like `Identifier`). - Magenta very carefully (if at all). ------ Notes - To make tests work without relatively larege updates, each one is prepended with an equivalent of the call `:colorscheme vim`. Plus some tests which spawn new Neovim instances also now use 'vim' color scheme. In some cases tests are updated to fit new default color scheme.
2023-10-01feat(ui): allow to get the highlight namespaceDaniel Steinberg1
2023-09-26fix(highlight): add force in nvim_set_hlglepnir1
2023-09-17fix(highlight): correct hi command outputglepnir1
2023-09-09fix(highlight): add create param in nvim_get_hlglepnir1
2023-08-07refactor(api): use typed keysetsbfredl1
Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata
2023-05-22fix(api): nvim_get_hl should return default flagNull Chilly1
2023-05-21refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-04-13fix(api): make nvim_get_hl not return non-existing groupsbfredl1
fixes #23063
2023-03-31fix(api): return both link and attributes with nvim_get_hl (#22824)Sindre T. Strøm1
Problem: No way to get the actual highlight attributes for a linked group through |nvim_get_hl()| (not the attributes from the link target). Solution: Return the actual attributes as well as the link target name.
2023-03-23fix(api): make nvim_get_hl return 'cterm' attrs properlybfredl1
2023-03-23feat(api): add nvim_get_hl (#22693)Null Chilly1
Problem: no way of getting all highlight group definitions in a namespace. Solution: add `nvim_get_hl()`, deprecate `nvim_get_hl_by_name()` and `nvim_get_hl_by_id()`.
2023-02-23fix(highlight): avoid ORing underline flags (#22372)zeertzjq1
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.
2023-02-14refactor(api): consistent VALIDATE messages #22262Justin M. Keyes1
Problem: Validation messages are not consistently formatted. - Parameter names sometimes are NOT quoted. - Descriptive names (non-parameters) sometimes ARE quoted. Solution: Always quote the `name` value passed to a VALIDATE macro _unless_ the value has whitespace.
2023-02-14refactor(api): VALIDATE macros #22256Justin M. Keyes1
- VALIDATE() takes a format string - deduplicate check_string_array - VALIDATE_RANGE - validate UI args
2023-01-31fix(highlight): properly deal with underline mask when listing (#22057)zeertzjq1
2023-01-24feat(highlight): define the concept of altfont as a (c)term rendering attributePaul "LeoNerd" Evans1
2023-01-24refactor(highlight): reshape the HL_UNDER* bits into a 3-bit integer maskPaul "LeoNerd" Evans1
Saves two bits for reuse for new features
2022-12-10fix(tests): initialize Screen.colors in API highlight testsJon Huhn1
2022-08-31fix(api): nvim_set_hl bail out on invalid group name (#20021)zeertzjq1
2022-08-17feat(ui): allow to set the highlight namespace per windowbfredl1
- reimplement 'winhl' in terms of highlight namespaces - check for EOF in screen tests (to indicate a likely crash)
2022-07-31fix(highlight): add missing 'nocombine' to nvim_get_hl_* apis (#19586)Munif Tanjim1
2022-06-30refactor(highlight)!: rename attributes to match Vim (#19159)zeertzjq1
Ref: https://github.com/vim/vim/commit/84f546363068e4ddfe14a8a2a2322bb8d3a25417 Rename: - `underlineline` to `underdouble` - `underdot` to `underdotted` - `underdash` to `underdashed` `underdouble` also now takes higher precedence than `undercurl`.
2022-06-21perf(highlight): don't allocate duplicates for color namesbfredl1
2022-06-16fix(hl): return cterm fg/bg even if they match Normal #18981Oliver Marriott1
Fixes #18980 - 831fa45ad84e is related but this doesn't regress that - The `cterm_normal_fg_color != ae.cterm_fg_color` comparison is originally carried from patch to patch starting all the way back in 29bc6dfabde2 where it was avoiding setting a HL attr. But `hlattrs2dict()` now is just informational.
2022-06-03fix(hl): set Normal hl group sg_attr value #18820Oliver Marriott1
fix #18024
2022-04-15docs: typo fixes (#17859)dundargoc1
Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com> Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com> Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: rwxd <rwxd@pm.me> Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
2022-03-03feat(tui): add support for `CSI 4 : [2,4,5] m`Kirill Chibisov1
This commit finishes support for colored and styled underlines adding `CSI 4 : [2,4,5] m` support providing double, dashed, and dotted underlines Fixes #17362.