feat(ui): allow to set the highlight namespace per window

- reimplement 'winhl' in terms of highlight namespaces
- check for EOF in screen tests (to indicate a likely crash)
This commit is contained in:
bfredl
2022-07-25 10:16:33 +02:00
parent f7cfca49d6
commit d879331b0d
30 changed files with 596 additions and 244 deletions

View File

@@ -603,20 +603,6 @@ nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
NB: if your UI doesn't use hlstate, this will not return hlstate first
time.
nvim__set_hl_ns({ns_id}) *nvim__set_hl_ns()*
Set active namespace for highlights.
NB: this function can be called from async contexts, but the semantics are
not yet well-defined. To start with |nvim_set_decoration_provider| on_win
and on_line callbacks are explicitly allowed to change the namespace
during a redraw cycle.
Attributes: ~
|api-fast|
Parameters: ~
{ns_id} the namespace to activate
nvim__stats() *nvim__stats()*
Gets internal stats.
@@ -1414,6 +1400,26 @@ nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
set, cterm attributes will match those from the attribute
map documented above.
nvim_set_hl_ns({ns_id}) *nvim_set_hl_ns()*
Set active namespace for highlights. This can be set for a single window,
see |nvim_win_set_hl_ns|.
Parameters: ~
{ns_id} the namespace to use
nvim_set_hl_ns_fast({ns_id}) *nvim_set_hl_ns_fast()*
Set active namespace for highlights while redrawing.
This function meant to be called while redrawing, primarily from
|nvim_set_decoration_provider| on_win and on_line callbacks, which are
allowed to change the namespace during a redraw cycle.
Attributes: ~
|api-fast|
Parameters: ~
{ns_id} the namespace to activate
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@@ -2875,6 +2881,15 @@ nvim_win_set_height({window}, {height}) *nvim_win_set_height()*
{window} Window handle, or 0 for current window
{height} Height as a count of rows
nvim_win_set_hl_ns({window}, {ns_id}) *nvim_win_set_hl_ns()*
Set highlight namespace for a window. This will use highlights defined in
this namespace, but fall back to global highlights (ns=0) when missing.
This takes predecence over the 'winhighlight' option.
Parameters: ~
{ns_id} the namespace to use
nvim_win_set_var({window}, {name}, {value}) *nvim_win_set_var()*
Sets a window-scoped (w:) variable

View File

@@ -7096,10 +7096,12 @@ A jump table for the options with a short description can be found at |Q_op|.
'winhighlight' 'winhl' string (default empty)
local to window
Window-local highlights. Comma-delimited list of highlight
|group-name| pairs "{hl-builtin}:{hl},..." where each {hl-builtin} is
a built-in |highlight-groups| item to be overridden by {hl} group in
the window. Only built-in |highlight-groups| are supported, not
syntax highlighting (use |:ownsyntax| for that).
|group-name| pairs "{hl-from}:{hl-to},..." where each {hl-from} is
a |highlight-groups| item to be overridden by {hl-to} group in
the window.
Note: highlight namespaces take precedence over 'winhighlight'.
See |nvim_win_set_hl_ns| and |nvim_set_hl|.
Highlights of vertical separators are determined by the window to the
left of the separator. The 'tabline' highlight of a tabpage is