From b8ae09b3cf990c9a374a46c644abe0191e09f2f8 Mon Sep 17 00:00:00 2001 From: Scott Prager Date: Sun, 5 Apr 2015 13:20:08 -0400 Subject: term: after , resume normal input loop Pressing 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 and only call terminal_send_key() if the next input is a key press. --- src/nvim/terminal.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') 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 + 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); } } -- cgit