Home Explore Blog CI



neovim

8th chunk of `runtime/doc/ui.txt`
1869971bdb7ce543262568583d17a5d00ba898ec7cdeccb40000000100000fa7
 (utf-8 encoded) string `text` is put at the cursor position
	(and the cursor is advanced), with the highlights as set by the
	last `highlight_set` update.

["set_scroll_region", top, bot, left, right] ~
	Define the scroll region used by `scroll` below.

	Note: ranges are end-inclusive, which is inconsistent with API
	conventions.

["scroll", count] ~
	Scroll the text in the scroll region. The diagrams below illustrate
	what will happen, depending on the scroll direction. "=" is used to
	represent the SR(scroll region) boundaries and "-" the moved rectangles.
	Note that dst and src share a common region.

	If count is bigger than 0, move a rectangle in the SR up, this can
	happen while scrolling down.
>
		+-------------------------+
		| (clipped above SR)      |            ^
		|=========================| dst_top    |
		| dst (still in SR)       |            |
		+-------------------------+ src_top    |
		| src (moved up) and dst  |            |
		|-------------------------| dst_bot    |
		| src (cleared)           |            |
		+=========================+ src_bot
<
	If count is less than zero, move a rectangle in the SR down, this can
	happen while scrolling up.
>
		+=========================+ src_top
		| src (cleared)           |            |
		|------------------------ | dst_top    |
		| src (moved down) and dst|            |
		+-------------------------+ src_bot    |
		| dst (still in SR)       |            |
		|=========================| dst_bot    |
		| (clipped below SR)      |            v
		+-------------------------+
<
==============================================================================
Highlight Events						  *ui-hlstate*

Activated by the `ext_hlstate` |ui-option|.
Activates |ui-linegrid| implicitly.

If `ext_hlstate` is enabled, Nvim will emit detailed highlight state in
|ui-linegrid| events. Otherwise (by default) Nvim only describes grid cells
using the final calculated highlight attributes described at
|ui-event-highlight_set|.

`ext_hlstate` provides a semantic description of active highlights for each
grid cell. Highlights are predefined in a table, see |ui-event-hl_attr_define|
and |ui-event-grid_line|.

The `info` parameter in `hl_attr_define` contains a semantic description of
the highlights. Because highlight groups can be combined, this is an array
where the highest-priority item is last. Each item is a dict with these keys:

    `kind`:	always present. One of the following values:
	"ui":       Builtin UI highlight. |highlight-groups|
	"syntax":   Highlight applied to a buffer by a syntax declaration or
		    other runtime/plugin functionality such as
		    |nvim_buf_set_extmark()|
	"terminal": highlight from a process running in a |terminal-emulator|.
		    Contains no further semantic information.
    `ui_name`:	Highlight name from |highlight-groups|. Only for "ui" kind.
    `hi_name`:	Name of the final |:highlight| group where the used
		attributes are defined.
    `id`:	Unique numeric id representing this item.

Note: "ui" items will have both `ui_name` and `hi_name` present. These can
differ, because the builtin group was linked to another group |:hi-link| , or
because 'winhighlight' was used. UI items will be transmitted, even if the
highlight group is cleared, so `ui_name` can always be used to reliably identify
screen elements, even if no attributes have been applied.

==============================================================================
Multigrid Events						 *ui-multigrid*

Activated by the `ext_multigrid` |ui-option|.
Activates |ui-linegrid| implicitly.

See |ui-linegrid| for grid events.
See |nvim_ui_try_resize_grid()| to request changing the grid size.
See |nvim_input_mouse()| for sending mouse events to Nvim.

The multigrid extension gives UIs more control over how windows are displayed:
- UIs receive updates on a separate grid for each window.
- UIs can set the grid size independently of how much space the window
  occupies on the global layout. So the UI could use a different

Title: Grid Scrolling, Highlight Events, and Multigrid Events
Summary
This section covers three aspects of the Neovim UI. First, it details the `put`, `set_scroll_region`, and `scroll` grid events, explaining how text is placed and scrolled within a defined region. Second, it describes the `ui-hlstate` highlight events activated by the `ext_hlstate` option, which provides detailed highlight state information in `ui-linegrid` events. Finally, it outlines the `ui-multigrid` events activated by `ext_multigrid`, giving UIs more control over window display with separate grids for each window.