mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 10:28:48 +00:00
In terminals with XT, turn on modifyOtherKeys=1 with the escape sequence and
handle the most common set. Pass them through if xterm-keys is on.
This commit is contained in:
parent
4c91c153cb
commit
8df3ec612a
@ -136,6 +136,7 @@ key_string_get_modifiers(const char **string)
|
|||||||
int
|
int
|
||||||
key_string_lookup_string(const char *string)
|
key_string_lookup_string(const char *string)
|
||||||
{
|
{
|
||||||
|
static const char *other = "!#()+,-.0123456789:;<=>?'\r\t";
|
||||||
int key, modifiers;
|
int key, modifiers;
|
||||||
u_short u;
|
u_short u;
|
||||||
int size;
|
int size;
|
||||||
@ -170,7 +171,7 @@ key_string_lookup_string(const char *string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the standard control keys. */
|
/* Convert the standard control keys. */
|
||||||
if (key < KEYC_BASE && (modifiers & KEYC_CTRL)) {
|
if (key < KEYC_BASE && (modifiers & KEYC_CTRL) && !strchr(other, key)) {
|
||||||
if (key >= 97 && key <= 122)
|
if (key >= 97 && key <= 122)
|
||||||
key -= 96;
|
key -= 96;
|
||||||
else if (key >= 64 && key <= 95)
|
else if (key >= 64 && key <= 95)
|
||||||
|
5
tty.c
5
tty.c
@ -223,7 +223,7 @@ tty_start_tty(struct tty *tty)
|
|||||||
tty_puts(tty, "\033[?1000l");
|
tty_puts(tty, "\033[?1000l");
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_XT))
|
if (tty_term_has(tty->term, TTYC_XT))
|
||||||
tty_puts(tty, "\033[c");
|
tty_puts(tty, "\033[c\033[>4;1m");
|
||||||
|
|
||||||
tty->cx = UINT_MAX;
|
tty->cx = UINT_MAX;
|
||||||
tty->cy = UINT_MAX;
|
tty->cy = UINT_MAX;
|
||||||
@ -285,6 +285,9 @@ tty_stop_tty(struct tty *tty)
|
|||||||
if (tty_term_has(tty->term, TTYC_KMOUS))
|
if (tty_term_has(tty->term, TTYC_KMOUS))
|
||||||
tty_raw(tty, "\033[?1000l");
|
tty_raw(tty, "\033[?1000l");
|
||||||
|
|
||||||
|
if (tty_term_has(tty->term, TTYC_XT))
|
||||||
|
tty_puts(tty, "\033[>4m");
|
||||||
|
|
||||||
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
|
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
|
||||||
|
|
||||||
setblocking(tty->fd, 1);
|
setblocking(tty->fd, 1);
|
||||||
|
28
xterm-keys.c
28
xterm-keys.c
@ -87,6 +87,34 @@ const struct xterm_keys_entry xterm_keys_table[] = {
|
|||||||
{ KEYC_NPAGE, "\033[6;_~" },
|
{ KEYC_NPAGE, "\033[6;_~" },
|
||||||
{ KEYC_IC, "\033[2;_~" },
|
{ KEYC_IC, "\033[2;_~" },
|
||||||
{ KEYC_DC, "\033[3;_~" },
|
{ KEYC_DC, "\033[3;_~" },
|
||||||
|
|
||||||
|
{ '!', "\033[27;_;33~" },
|
||||||
|
{ '#', "\033[27;_;35~" },
|
||||||
|
{ '(', "\033[27;_;40~" },
|
||||||
|
{ ')', "\033[27;_;41~" },
|
||||||
|
{ '+', "\033[27;_;43~" },
|
||||||
|
{ ',', "\033[27;_;44~" },
|
||||||
|
{ '-', "\033[27;_;45~" },
|
||||||
|
{ '.', "\033[27;_;46~" },
|
||||||
|
{ '0', "\033[27;_;48~" },
|
||||||
|
{ '1', "\033[27;_;49~" },
|
||||||
|
{ '2', "\033[27;_;50~" },
|
||||||
|
{ '3', "\033[27;_;51~" },
|
||||||
|
{ '4', "\033[27;_;52~" },
|
||||||
|
{ '5', "\033[27;_;53~" },
|
||||||
|
{ '6', "\033[27;_;54~" },
|
||||||
|
{ '7', "\033[27;_;55~" },
|
||||||
|
{ '8', "\033[27;_;56~" },
|
||||||
|
{ '9', "\033[27;_;57~" },
|
||||||
|
{ ':', "\033[27;_;58~" },
|
||||||
|
{ ';', "\033[27;_;59~" },
|
||||||
|
{ '<', "\033[27;_;60~" },
|
||||||
|
{ '=', "\033[27;_;61~" },
|
||||||
|
{ '>', "\033[27;_;62~" },
|
||||||
|
{ '?', "\033[27;_;63~" },
|
||||||
|
{ '\'', "\033[27;_;39~" },
|
||||||
|
{ '\r', "\033[27;_;13~" },
|
||||||
|
{ '\t', "\033[27;_;9~" },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user