aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2015-11-23 13:19:00 +0100
committerMarco Hinz <mh.codebro@gmail.com>2015-11-23 13:19:00 +0100
commit97cee2c2e39888b33a546ba5ffe37c510740c3a5 (patch)
treed57b9ccf05ca0f910f6af2fbcc95d04e5e523caf /src
parent321db59ca1dc304feb3e00c10ca3e89c1de616e7 (diff)
parent6329fd420eec1f1325be2131726e82e23da3e90b (diff)
downloadrneovim-97cee2c2e39888b33a546ba5ffe37c510740c3a5.tar.gz
rneovim-97cee2c2e39888b33a546ba5ffe37c510740c3a5.tar.bz2
rneovim-97cee2c2e39888b33a546ba5ffe37c510740c3a5.zip
Merge PR #3715 'Enable focus events in cmdline and terminal modes'
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c8
-rw-r--r--src/nvim/terminal.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 52292128d8..cbaf15e38d 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1448,6 +1448,14 @@ static int command_line_handle_key(CommandLineState *s)
}
return command_line_not_changed(s);
+ case K_FOCUSGAINED: // Neovim has been given focus
+ apply_autocmds(EVENT_FOCUSGAINED, NULL, NULL, false, curbuf);
+ return command_line_not_changed(s);
+
+ case K_FOCUSLOST: // Neovim has lost focus
+ apply_autocmds(EVENT_FOCUSLOST, NULL, NULL, false, curbuf);
+ return command_line_not_changed(s);
+
default:
// Normal character with no special meaning. Just set mod_mask
// to 0x0 so that typing Shift-Space in the GUI doesn't enter
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: