Home Explore Blog CI



neovim

4th chunk of `runtime/doc/ui.txt`
8254ec9de9ea65db64d4d5c984aa12b2f2832ea2e8c6367b0000000100000fa0
 their effects are communicated in
	other UI events. For example, instead of forwarding the 'mouse' option
	value, the "mouse_on" and "mouse_off" UI events directly indicate if
	mouse support is active. Some options like 'ambiwidth' have already
	taken effect on the grid, where appropriate empty cells are added,
	however a UI might still use such options when rendering raw text
	sent from Nvim, like for |ui-cmdline|.

["chdir", path] ~
	The |current-directory| changed to `path`.

["mode_change", mode, mode_idx] ~
	Editor mode changed.  The `mode` parameter is a string representing
	the current mode. `mode_idx` is an index into the array emitted in
	the `mode_info_set` event. UIs should change the cursor style
	according to the properties specified in the corresponding item. The
	set of modes reported will change in new versions of Nvim, for
	instance more submodes and temporary states might be represented as
	separate modes.

["mouse_on"] ~
["mouse_off"] ~
	'mouse' was enabled/disabled in the current editor mode. Useful for
	a terminal UI, or embedding into an application where Nvim mouse would
	conflict with other usages of the mouse. Other UI:s may ignore this event.

["busy_start"] ~
["busy_stop"] ~
	Indicates to the UI that it must stop rendering the cursor. This event
	is misnamed and does not actually have anything to do with busyness.

["restart", progpath, argv] ~
	|:restart| command has been used and the Nvim server is about to exit.
	The UI should wait for the server to exit, and then start a new server
	using `progpath` as the full path to the Nvim executable |v:progpath| and
	`argv` as its arguments |v:argv|, and reattach to the new server.
	Note: |--embed| and |--headless| are excluded from `argv`, and the client
	should decide itself whether to add either flag.

["suspend"] ~
	|:suspend| command or |CTRL-Z| mapping is used. A terminal client (or
	another client where it makes sense) could suspend itself.  Other
	clients can safely ignore it.

["update_menu"] ~
	The menu mappings changed.

["bell"] ~
["visual_bell"] ~
	Notify the user with an audible or visual bell, respectively.

["flush"] ~
	Nvim is done redrawing the screen. For an implementation that renders
	to an internal buffer, this is the time to display the redrawn parts
	to the user.

==============================================================================
Grid Events (line-based)					  *ui-linegrid*

Activated by the `ext_linegrid` |ui-option|. Recommended for all new UIs.
Deactivates |ui-grid-old| implicitly.

Unlike |ui-grid-old|, this UI extension emits a single `grid_line` event to
update a screen-line (whereas the old protocol emitted separate cursor,
highlight and text events per screen-line).

Most of these events take a `grid` index as first parameter.  Grid 1 is the
global grid used by default for the entire editor screen state. The
`ext_linegrid` capability by itself will never cause any additional grids to
be created; to enable per-window grids, activate |ui-multigrid|.

Highlight attribute groups are predefined. UIs should maintain a table to map
numerical highlight ids to the actual attributes.

["grid_resize", grid, width, height] ~
	Resize a `grid`. If `grid` wasn't seen by the client before, a new grid is
	being created with this size.

["default_colors_set", rgb_fg, rgb_bg, rgb_sp, cterm_fg, cterm_bg] ~
	The first three arguments set the default foreground, background and
	special colors respectively. `cterm_fg` and `cterm_bg` specifies the
	default color codes to use in a 256-color terminal.

	The RGB values will always be valid colors, by default. If no
	colors have been set, they will default to black and white, depending
	on 'background'. By setting the `ext_termcolors` option, instead
	-1 will be used for unset colors. This is mostly useful for a TUI
	implementation, where using the terminal builtin ("ANSI") defaults
	are expected.

	Note: Unlike the corresponding |ui-grid-old| events, the screen is not
	always cleared after

Title: More UI Events: Mode Change, Mouse, Bells, and Grid Events
Summary
This section details several more UI events, including changes to the current directory (`chdir`), editor mode (`mode_change`), mouse status (`mouse_on`, `mouse_off`), "busy" status (`busy_start`, `busy_stop`), server restart (`restart`), suspension (`suspend`), menu changes (`update_menu`), bell notifications (`bell`, `visual_bell`), and screen flushing (`flush`). It then introduces grid events activated by `ext_linegrid`, including resizing grids (`grid_resize`) and setting default colors (`default_colors_set`), which define the base colors for the UI.