aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorJoe Hermaszewski <git@monoid.al>2015-11-20 18:47:20 +0000
committerMarco Hinz <mh.codebro@gmail.com>2015-11-23 13:18:27 +0100
commit442cd0672b567cce56dd45e731ec1cc3b71b7cf4 (patch)
tree334a3fce2f9ee94351b046d824284a73c77f0275 /src/nvim/terminal.c
parent321db59ca1dc304feb3e00c10ca3e89c1de616e7 (diff)
downloadrneovim-442cd0672b567cce56dd45e731ec1cc3b71b7cf4.tar.gz
rneovim-442cd0672b567cce56dd45e731ec1cc3b71b7cf4.tar.bz2
rneovim-442cd0672b567cce56dd45e731ec1cc3b71b7cf4.zip
Enable focus events in cmdline and terminal modes
This change adds switch cases for K_FOCUSGAINED and K_FOCUSLOST to the input handling functions in ex_getln.c and terminal.c. The handling is identical to what's found in edit.c (just calling apply_autocmds). If one enters cmdline-mode by feeding `:` and sends a focuslost event (by leaving the window for example) the text `<FocusLost>` will be inserted into the command line. There is similar behaviour in terminal mode. This patch corrects this behavior to fire the apropriate autocmd instead. Fixes #3714
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 119ee2c5b3..adf3f725a2 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -402,6 +402,14 @@ static int terminal_execute(VimState *state, int key)
TerminalState *s = (TerminalState *)state;
switch (key) {
+ 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_LEFTMOUSE:
case K_LEFTDRAG:
case K_LEFTRELEASE: