0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.2134: modifier keys are not always recognized

Problem:    Modifier keys are not always recognized.
Solution:   Handle key codes generated by xterm with modifyOtherKeys set.
            Add this to libvterm so we can debug it.
This commit is contained in:
Bram Moolenaar
2019-10-10 21:14:03 +02:00
parent 07282f01da
commit 6a0299d8f4
9 changed files with 185 additions and 65 deletions

View File

@@ -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