summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 42a80cd7d..a992b444d 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1371,11 +1371,13 @@ term_convert_key(term_T *term, int c, char *buf)
break;
}
+ // add modifiers for the typed key
+ mod |= mod_mask;
+
/*
* Convert special keys to vterm keys:
* - Write keys to vterm: vterm_keyboard_key()
* - Write output to channel.
- * TODO: use mod_mask
*/
if (key != VTERM_KEY_NONE)
/* Special key, let vterm convert it. */
@@ -1902,15 +1904,21 @@ term_vgetc()
{
int c;
int save_State = State;
+ int modify_other_keys =
+ vterm_is_modify_other_keys(curbuf->b_term->tl_vterm);
State = TERMINAL;
got_int = FALSE;
#ifdef MSWIN
ctrl_break_was_pressed = FALSE;
#endif
+ if (modify_other_keys)
+ ++no_reduce_keys;
c = vgetc();
got_int = FALSE;
State = save_State;
+ if (modify_other_keys)
+ --no_reduce_keys;
return c;
}
@@ -2255,6 +2263,7 @@ term_win_entered()
terminal_loop(int blocking)
{
int c;
+ int raw_c;
int termwinkey = 0;
int ret;
#ifdef UNIX
@@ -2307,6 +2316,13 @@ terminal_loop(int blocking)
if (c == K_IGNORE)
continue;
+ // vgetc may not include CTRL in the key when modify_other_keys is set.
+ raw_c = c;
+ if ((mod_mask & MOD_MASK_CTRL)
+ && ((c >= '`' && c <= 0x7f)
+ || (c >= '@' && c <= '_')))
+ c &= 0x1f;
+
#ifdef UNIX
/*
* The shell or another program may change the tty settings. Getting
@@ -2417,7 +2433,7 @@ terminal_loop(int blocking)
c = wc;
}
# endif
- if (send_keys_to_term(curbuf->b_term, c, TRUE) != OK)
+ if (send_keys_to_term(curbuf->b_term, raw_c, TRUE) != OK)
{
if (c == K_MOUSEMOVE)
/* We are sure to come back here, don't reset the cursor color