mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
Implement handling of terminal focus events
Two new keys have been added to key_name_entry in keymap.c: `FocusGained` and `FocusLost`. Two cases have been added to the key handing switch in edit.c each applying their respective autocmds. In normal.c two functions have been added alongside nv_cursorhold doing a similar job of applying the autocmd for the appropriate key. tui/input.c has a new function `handle_focus_event` which eats either of the control sequences for focus gained or lost. This function is checked before handle_bracketed_paste and handle_forced_escape. tui.c registers neovim as able to receive these control sequences in terminfo_start and undoes that in terminfo_stop. Closes #2302
This commit is contained in:
@@ -977,6 +977,14 @@ static int insert_handle_key(InsertState *s)
|
||||
queue_process_events(loop.events);
|
||||
break;
|
||||
|
||||
case K_FOCUSGAINED: // Neovim has been given focus
|
||||
apply_autocmds(EVENT_FOCUSGAINED, NULL, NULL, false, curbuf);
|
||||
break;
|
||||
|
||||
case K_FOCUSLOST: // Neovim has lost focus
|
||||
apply_autocmds(EVENT_FOCUSLOST, NULL, NULL, false, curbuf);
|
||||
break;
|
||||
|
||||
case K_HOME: // <Home>
|
||||
case K_KHOME:
|
||||
case K_S_HOME:
|
||||
|
Reference in New Issue
Block a user