aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 2ad5ac49ca..197a225209 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -783,7 +783,12 @@ static int terminal_execute(VimState *state, int key)
{
TerminalState *s = (TerminalState *)state;
- switch (key) {
+ // Check for certain control keys like Ctrl-C and Ctrl-\. We still send the
+ // unmerged key and modifiers to the terminal.
+ int tmp_mod_mask = mod_mask;
+ int mod_key = merge_modifiers(key, &tmp_mod_mask);
+
+ switch (mod_key) {
case K_LEFTMOUSE:
case K_LEFTDRAG:
case K_LEFTRELEASE:
@@ -841,13 +846,13 @@ static int terminal_execute(VimState *state, int key)
FALLTHROUGH;
default:
- if (key == Ctrl_C) {
+ if (mod_key == Ctrl_C) {
// terminal_enter() always sets `mapped_ctrl_c` to avoid `got_int`. 8eeda7169aa4
// But `got_int` may be set elsewhere, e.g. by interrupt() or an autocommand,
// so ensure that it is cleared.
got_int = false;
}
- if (key == Ctrl_BSL && !s->got_bsl) {
+ if (mod_key == Ctrl_BSL && !s->got_bsl) {
s->got_bsl = true;
break;
}
@@ -1016,7 +1021,7 @@ static void terminal_send_key(Terminal *term, int c)
VTermKey key = convert_key(&c, &mod);
- if (key) {
+ if (key != VTERM_KEY_NONE) {
vterm_keyboard_key(term->vt, key, mod);
} else if (!IS_SPECIAL(c)) {
vterm_keyboard_unichar(term->vt, (uint32_t)c, mod);