diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-09-06 07:25:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-06 07:25:01 +0200 |
| commit | 51808a244ecaa0a40b4e8280938333d2792d8422 (patch) | |
| tree | 722b303136a2dec83f3f4f14ee0b5d3aa62fa559 /src/nvim/tui/input.c | |
| parent | 82795c2c3a429b2725af882cad4317bed8f1b741 (diff) | |
| parent | b9d6bda53126433cbb251b47d8788d92cda9e6e4 (diff) | |
| download | rneovim-51808a244ecaa0a40b4e8280938333d2792d8422.tar.gz rneovim-51808a244ecaa0a40b4e8280938333d2792d8422.tar.bz2 rneovim-51808a244ecaa0a40b4e8280938333d2792d8422.zip | |
Merge #7221 from justinmk/ev-focusgained
tui: schedule event instead of <FocusGained> pseudokey
Diffstat (limited to 'src/nvim/tui/input.c')
| -rw-r--r-- | src/nvim/tui/input.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 03587d68f0..8bb5971bd4 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -8,6 +8,7 @@ #include "nvim/api/private/helpers.h" #include "nvim/ascii.h" #include "nvim/main.h" +#include "nvim/aucmd.h" #include "nvim/os/os.h" #include "nvim/os/input.h" #include "nvim/event/rstream.h" @@ -280,9 +281,9 @@ static void timer_cb(TimeWatcher *watcher, void *data) /// Handle focus events. /// -/// If the upcoming sequence of bytes in the input stream matches either the -/// escape code for focus gained `<ESC>[I` or focus lost `<ESC>[O` then consume -/// that sequence and push the appropriate event into the input queue +/// If the upcoming sequence of bytes in the input stream matches the termcode +/// for "focus gained" or "focus lost", consume that sequence and schedule an +/// event on the main loop. /// /// @param input the input stream /// @return true iff handle_focus_event consumed some input @@ -294,11 +295,7 @@ static bool handle_focus_event(TermInput *input) // Advance past the sequence bool focus_gained = *rbuffer_get(input->read_stream.buffer, 2) == 'I'; rbuffer_consumed(input->read_stream.buffer, 3); - if (focus_gained) { - enqueue_input(input, FOCUSGAINED_KEY, sizeof(FOCUSGAINED_KEY) - 1); - } else { - enqueue_input(input, FOCUSLOST_KEY, sizeof(FOCUSLOST_KEY) - 1); - } + aucmd_schedule_focusgained(focus_gained); return true; } return false; |