mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 03:58:32 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user