Home Explore Blog CI



neovim

7th chunk of `runtime/doc/ui.txt`
fe749e958747c68078e329e2ef458ea7b3512d85d8e7e7bd0000000100000fa0
	+-------------------------+ 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| directly
	after the scroll event. The UI thus doesn't need to clear this area as
	part of handling the scroll event.

==============================================================================
Grid Events (cell-based)					   *ui-grid-old*

This is the legacy representation of the screen grid, emitted if |ui-linegrid|
is not active. New UIs should implement |ui-linegrid| instead.

["resize", width, height] ~
	The grid is resized to `width` and `height` cells.

["clear"] ~
	Clear the grid.

["eol_clear"] ~
	Clear from the cursor position to the end of the current line.

["cursor_goto", row, col] ~
	Move the cursor to position (row, col). Currently, the same cursor is
	used to define the position for text insertion and the visible cursor.
	However, only the last cursor position, after processing the entire
	array in the "redraw" event, is intended to be a visible cursor
	position.

["update_fg", color] ~
["update_bg", color] ~
["update_sp", color] ~
	Set the default foreground, background and special colors
	respectively.

							*ui-event-highlight_set*
["highlight_set", attrs] ~
	Set the attributes that the next text put on the grid will have.
	`attrs` is a dict with the keys below. Any absent key is reset
	to its default value. Color defaults are set by the `update_fg` etc
	updates. All boolean keys default to false.

	`foreground`:	foreground color.
	`background`:	background color.
	`special`:	color to use for various underlines, when present.
	`reverse`:	reverse video. Foreground and background colors are
			switched.
	`italic`:	italic text.
	`bold`:		bold text.
	`strikethrough`:  struckthrough text.
	`underline`:	underlined text. The line has `special` color.
	`undercurl`:	undercurled text. The curl has `special` color.
	`underdouble`:	double underlined text. The lines have `special` color.
	`underdotted`:	underdotted text. The dots have `special` color.
	`underdashed`:	underdashed text. The dashes have `special` color.

["put", text] ~
	The (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    |
		|

Title: Legacy Grid Events (Cell-Based)
Summary
This section details the legacy grid events used when `ui-linegrid` is not active. It includes `resize` (resizes the grid), `clear` (clears the grid), `eol_clear` (clears from the cursor to the end of the line), `cursor_goto` (moves the cursor), `update_fg`, `update_bg`, and `update_sp` (set default colors), `highlight_set` (sets text attributes), `put` (puts text with current highlights), `set_scroll_region` (defines the scroll region), and `scroll` (scrolls the text in the scroll region).