diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-28 01:27:57 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2017-09-05 15:01:06 +0200 |
| commit | b6b6e4a96f37ba6a54d194ecbc042d5ef7d595e6 (patch) | |
| tree | a2325b8f194daceab79e038ea58105634b4d48d9 /src/nvim/tui | |
| parent | ce852bab04c63262ce8545c01a4ff4fc827148a1 (diff) | |
| download | rneovim-b6b6e4a96f37ba6a54d194ecbc042d5ef7d595e6.tar.gz rneovim-b6b6e4a96f37ba6a54d194ecbc042d5ef7d595e6.tar.bz2 rneovim-b6b6e4a96f37ba6a54d194ecbc042d5ef7d595e6.zip | |
eventloop: FocusGained: schedule event instead of pseudokey
closes #4840
closes #6164
Diffstat (limited to 'src/nvim/tui')
| -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; |