patch 9.0.0912: libvterm with modifyOtherKeys level 2 does not match xterm

Problem:    libvterm with modifyOtherKeys level 2 does not match xterm.
Solution:   Adjust key code escape sequences to be the same as what xterm
            sends in modifyOtherKeys level 2 mode.  Check the value of
            no_reduce_keys before using it.
This commit is contained in:
Bram Moolenaar
2022-11-19 19:02:40 +00:00
parent e6392b1021
commit c896adbcde
8 changed files with 70 additions and 13 deletions

View File

@ -14,7 +14,7 @@ int vterm_is_modify_other_keys(VTerm *vt)
void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod)
{
// VIM: added modifyOtherKeys support
if (vt->state->mode.modify_other_keys && mod != 0) {
if (vterm_is_modify_other_keys(vt) && mod != 0) {
vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, c);
return;
}
@ -184,7 +184,9 @@ void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod)
break;
case KEYCODE_LITERAL: case_LITERAL:
if(mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL))
if (vterm_is_modify_other_keys(vt) && mod != 0)
vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, k.literal);
else if(mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL))
vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", k.literal, mod+1);
else
vterm_push_output_sprintf(vt, mod & VTERM_MOD_ALT ? ESC_S "%c" : "%c", k.literal);