termptyesc: handle Application Escape Code

Should make your vim more responsive ;)
This commit is contained in:
Boris Faure 2023-08-14 20:09:50 +02:00
parent ea122be0a9
commit 85c6d89414
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
4 changed files with 24 additions and 3 deletions

View File

@ -133,6 +133,25 @@ keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
}
return;
}
if (!strcmp(ev->key, "Escape"))
{
if (ty->termstate.esc_keycode)
{
TERMPTY_WRITE_STR("\033O[");
}
else
{
if (alt)
{
TERMPTY_WRITE_STR("\x9b");
}
else
{
TERMPTY_WRITE_STR("\033");
}
}
return;
}
if (!strcmp(ev->key, "Return"))
{
if (alt)

View File

@ -132,6 +132,7 @@ typedef struct tag_Term_State {
unsigned int hide_cursor : 1;
unsigned int combining_strike : 1;
unsigned int sace_rectangular : 1;
unsigned int esc_keycode : 1;
int xmod[6];
} Term_State;

View File

@ -543,9 +543,9 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b,
WRN("TODO: ambigous width reporting %i", mode);
ty->decoding_error = EINA_TRUE;
break;
case 7727: // ignore
WRN("TODO: enable application escape mode %i", mode);
ty->decoding_error = EINA_TRUE;
case 7727:
DBG("%s application escape mode", mode ? "enable" : "disable");
ty->termstate.esc_keycode = !!mode;
break;
case 7766: // ignore
WRN("TODO: %s scrollbar", mode ? "hide" : "show");

View File

@ -451,6 +451,7 @@ termpty_soft_reset_state(Termpty *ty)
ty->termstate.cjk_ambiguous_wide = 0;
ty->termstate.hide_cursor = 0;
ty->termstate.sace_rectangular = 0;
ty->termstate.esc_keycode = 0;
ty->mouse_mode = MOUSE_OFF;
ty->mouse_ext = MOUSE_EXT_NONE;
ty->bracketed_paste = 0;