Merge pull request #53 from oxalica/fix/tmux-home-end

Fix Home (\e[1~) and End (\e[4~) in tmux
This commit is contained in:
Joachim Wiberg 2021-05-29 15:22:18 +02:00 committed by GitHub
commit 0f4f5b0228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1041,8 +1041,12 @@ static el_status_t meta(void)
case '1': case '1':
{ {
char seq[4] = { 0 }; char seq[4] = { 0 };
seq[0] = tty_get();
for (c = 0; c < 3; c++) if (seq[0] == '~')
return beg_line(); /* Home */
for (c = 1; c < 3; c++)
seq[c] = tty_get(); seq[c] = tty_get();
if (!strncmp(seq, ";5C", 3)) if (!strncmp(seq, ";5C", 3))
@ -1054,6 +1058,7 @@ static el_status_t meta(void)
} }
case '2': tty_get(); return CSstay; /* Insert */ case '2': tty_get(); return CSstay; /* Insert */
case '3': tty_get(); return del_char(); /* Delete */ case '3': tty_get(); return del_char(); /* Delete */
case '4': tty_get(); return end_line(); /* End */
case '5': tty_get(); return CSstay; /* PgUp */ case '5': tty_get(); return CSstay; /* PgUp */
case '6': tty_get(); return CSstay; /* PgDn */ case '6': tty_get(); return CSstay; /* PgDn */
case 'A': return h_prev(); /* Up */ case 'A': return h_prev(); /* Up */