Home Explore Blog CI



neovim

6th chunk of `runtime/doc/ui.txt`
05cb9004cf7eb34d559a4e700e839806f5b21995907f8ae00000000100000fb0
 full.
	In that case Nvim will always issue redraws of screen cells that are
	affected by redefined ids, so UIs do not need to keep track of this
	themselves.

	`info` is an empty array unless |ui-hlstate| is enabled.

["hl_group_set", name, hl_id] ~
	The built-in highlight group `name` was set to use the attributes `hl_id`
	defined by a previous `hl_attr_define` call. This event is not needed
	to render the grids which use attribute ids directly, but is useful
	for a UI who want to render its own elements with consistent
	highlighting. For instance a UI using |ui-popupmenu| events, might
	use the |hl-Pmenu| family of builtin highlights.

							    *ui-event-grid_line*
["grid_line", grid, row, col_start, cells, wrap] ~
	Redraw a continuous part of a `row` on a `grid`, starting at the column
	`col_start`. `cells` is an array of arrays each with 1 to 3 items:
	`[text(, hl_id, repeat)]` . `text` is the UTF-8 text that should be put in
	a cell, with the highlight `hl_id` defined by a previous `hl_attr_define`
	call.  If `hl_id` is not present the most recently seen `hl_id` in
	the same call should be used (it is always sent for the first
	cell in the event). If `repeat` is present, the cell should be
	repeated `repeat` times (including the first time), otherwise just
	once.

	The right cell of a double-width char will be represented as the empty
	string. Double-width chars never use `repeat`.

	If the array of cell changes doesn't reach to the end of the line, the
	rest should remain unchanged. A whitespace char, repeated
	enough to cover the remaining line, will be sent when the rest of the
	line should be cleared.

	`wrap` is a boolean indicating that this line wraps to the next row.
	When redrawing a line which wraps to the next row, Nvim will emit a
	`grid_line` event covering the last column of the line with `wrap` set
	to true, followed immediately by a `grid_line` event starting at the
	first column of the next row.

["grid_clear", grid] ~
	Clear a `grid`.

["grid_destroy", grid] ~
	`grid` will not be used anymore and the UI can free any data associated
	with it.

["grid_cursor_goto", grid, row, col] ~
	Makes `grid` the current grid and `row, col` the cursor position on this
	grid.  This event will be sent at most once in a `redraw` batch and
	indicates the visible cursor position.

["grid_scroll", grid, top, bot, left, right, rows, cols] ~
	Scroll a region of `grid`. This is semantically unrelated to editor
	|scrolling|, rather this is an optimized way to say "copy these screen
	cells".

	The following diagrams show what happens per scroll direction.
	"===" represents the SR (scroll region) boundaries.
	"---" represents the moved rectangles.
	Note that dst and src share a common region.

	If `rows` 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 (invalid)           |            |
		+=========================+ src_bot
<
	If `rows` is less than zero, move a rectangle in the SR down, this can
	happen while scrolling up.
>
		+=========================+ src_top
		| src (invalid)           |            |
		|------------------------ | dst_top    |
		| src (moved down) and dst|            |
		+-------------------------+ src_bot    |
		| dst (still in SR)       |            |
		|=========================| dst_bot    |
		| (clipped below SR)      |            v
		+-------------------------+
<
	`cols` is always zero in this version of Nvim, and reserved for future
	use.

	Note when updating code from |ui-grid-old| events: ranges are
	end-exclusive, which is consistent with API conventions, but different
	from `set_scroll_region` which was end-inclusive.

	The scrolled-in area will be filled using |ui-event-grid_line|

Title: Grid Line, Clear, Destroy, Cursor, and Scroll Events
Summary
This section describes `grid_line`, which redraws a continuous part of a row on a grid. The `cells` array contains text, highlight ID, and repeat count. It also covers `grid_clear` (clears a grid), `grid_destroy` (frees data associated with a grid), `grid_cursor_goto` (sets the cursor position on a grid), and `grid_scroll` (scrolls a region of a grid).