diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2015-04-05 13:20:08 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2015-04-05 13:40:21 -0400 |
commit | b8ae09b3cf990c9a374a46c644abe0191e09f2f8 (patch) | |
tree | 2caba7bd636fa1c62984a4565c7c09a26b8d9b7c /src/nvim/terminal.c | |
parent | b6296f4e84217adaa3326c715d4e2c82a105bc39 (diff) | |
download | rneovim-b8ae09b3cf990c9a374a46c644abe0191e09f2f8.tar.gz rneovim-b8ae09b3cf990c9a374a46c644abe0191e09f2f8.tar.bz2 rneovim-b8ae09b3cf990c9a374a46c644abe0191e09f2f8.zip |
term: after <C-\>, resume normal input loop
Pressing <C-\> and then a mouse click will insert the click into the
terminal as if a keyboard button had been pressed.
Keep track of whether the last input was <C-\> and only call
terminal_send_key() if the next input is a key press.
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 9f4d81be19..ed1a8f32b3 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -376,6 +376,8 @@ void terminal_enter(bool process_deferred) int c; bool close = false; + bool got_bs = false; // True if the last input was <C-\> + while (term->buf == curbuf) { if (process_deferred) { event_enable_deferred(); @@ -388,14 +390,6 @@ void terminal_enter(bool process_deferred) } switch (c) { - case Ctrl_BSL: - c = safe_vgetc(); - if (c == Ctrl_N) { - goto end; - } - terminal_send_key(term, c); - break; - case K_LEFTMOUSE: case K_LEFTDRAG: case K_LEFTRELEASE: @@ -416,12 +410,22 @@ void terminal_enter(bool process_deferred) event_process(); break; + case Ctrl_N: + if (got_bs) { + goto end; + } + default: + if (c == Ctrl_BSL && !got_bs) { + got_bs = true; + break; + } if (term->closed) { close = true; goto end; } + got_bs = false; terminal_send_key(term, c); } } |