mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Use tty_term_flag not _has for XT, and make -2 force direct use of
256-colour escape sequences (so setaf/setab can be bypassed if needed).
This commit is contained in:
parent
3ebcf25149
commit
63a3fd3c0f
18
tty.c
18
tty.c
@ -228,7 +228,7 @@ tty_start_tty(struct tty *tty)
|
|||||||
if (tty_term_has(tty->term, TTYC_KMOUS))
|
if (tty_term_has(tty->term, TTYC_KMOUS))
|
||||||
tty_puts(tty, "\033[?1000l\033[?1002l\033[?1006l\033[?1005l");
|
tty_puts(tty, "\033[?1000l\033[?1002l\033[?1006l\033[?1005l");
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_XT)) {
|
if (tty_term_flag(tty->term, TTYC_XT)) {
|
||||||
if (options_get_number(&global_options, "focus-events")) {
|
if (options_get_number(&global_options, "focus-events")) {
|
||||||
tty->flags |= TTY_FOCUS;
|
tty->flags |= TTY_FOCUS;
|
||||||
tty_puts(tty, "\033[?1004h");
|
tty_puts(tty, "\033[?1004h");
|
||||||
@ -293,7 +293,7 @@ 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\033[?1002l\033[?1006l\033[?1005l");
|
tty_raw(tty, "\033[?1000l\033[?1002l\033[?1006l\033[?1005l");
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_XT)) {
|
if (tty_term_flag(tty->term, TTYC_XT)) {
|
||||||
if (tty->flags & TTY_FOCUS) {
|
if (tty->flags & TTY_FOCUS) {
|
||||||
tty->flags &= ~TTY_FOCUS;
|
tty->flags &= ~TTY_FOCUS;
|
||||||
tty_raw(tty, "\033[?1004l");
|
tty_raw(tty, "\033[?1004l");
|
||||||
@ -1647,6 +1647,13 @@ tty_try_256(struct tty *tty, u_char colour, const char *type)
|
|||||||
{
|
{
|
||||||
char s[32];
|
char s[32];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the user has specified -2 to the client, setaf and setab may not
|
||||||
|
* work (or they may not want to use them), so send the usual sequence.
|
||||||
|
*/
|
||||||
|
if (tty->term_flags & TERM_256COLOURS)
|
||||||
|
goto fallback;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the terminfo entry has 256 colours and setaf and setab exist,
|
* If the terminfo entry has 256 colours and setaf and setab exist,
|
||||||
* assume that they work correctly.
|
* assume that they work correctly.
|
||||||
@ -1664,13 +1671,6 @@ tty_try_256(struct tty *tty, u_char colour, const char *type)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If the user has specified -2 to the client, setaf and setab may not
|
|
||||||
* work, so send the usual sequence.
|
|
||||||
*/
|
|
||||||
if (tty->term_flags & TERM_256COLOURS)
|
|
||||||
goto fallback;
|
|
||||||
|
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
fallback:
|
fallback:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user