mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Sync OpenBSD patchset 589:
Pass through the aixterm bright colours if the terminal supports them (>= 16 colours).
This commit is contained in:
parent
de15f2b567
commit
99075aaa72
8
input.c
8
input.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: input.c,v 1.104 2009-12-04 22:14:47 tcunha Exp $ */
|
/* $Id: input.c,v 1.105 2009-12-16 01:13:09 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -1481,8 +1481,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
|
|||||||
case 95:
|
case 95:
|
||||||
case 96:
|
case 96:
|
||||||
case 97:
|
case 97:
|
||||||
gc->flags |= GRID_FLAG_FG256;
|
gc->fg = m;
|
||||||
gc->fg = m - 82;
|
|
||||||
break;
|
break;
|
||||||
case 100:
|
case 100:
|
||||||
case 101:
|
case 101:
|
||||||
@ -1492,8 +1491,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
|
|||||||
case 105:
|
case 105:
|
||||||
case 106:
|
case 106:
|
||||||
case 107:
|
case 107:
|
||||||
gc->flags |= GRID_FLAG_BG256;
|
gc->bg = m;
|
||||||
gc->bg = m - 92;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
tty.c
29
tty.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tty.c,v 1.182 2009-12-04 22:17:26 tcunha Exp $ */
|
/* $Id: tty.c,v 1.183 2009-12-16 01:13:09 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -1236,6 +1236,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, u_char *attr)
|
|||||||
if (fg == tc->fg && bg == tc->bg &&
|
if (fg == tc->fg && bg == tc->bg &&
|
||||||
((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0)
|
((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0)
|
||||||
return;
|
return;
|
||||||
|
log_debug("fg was %hhu, now %hhu", tc->fg, fg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is either the default colour? This is handled specially because the
|
* Is either the default colour? This is handled specially because the
|
||||||
@ -1297,6 +1298,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
|
|||||||
{
|
{
|
||||||
struct grid_cell *tc = &tty->cell;
|
struct grid_cell *tc = &tty->cell;
|
||||||
u_char fg = gc->fg;
|
u_char fg = gc->fg;
|
||||||
|
char s[32];
|
||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_FG256) {
|
if (gc->flags & GRID_FLAG_FG256) {
|
||||||
@ -1315,6 +1317,18 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
|
|||||||
tty_reset(tty); /* turn off bold */
|
tty_reset(tty); /* turn off bold */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Is this an aixterm bright colour? */
|
||||||
|
if (fg >= 90 && fg <= 97) {
|
||||||
|
/* 16 colour terminals or above only. */
|
||||||
|
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {
|
||||||
|
xsnprintf(s, sizeof s, "\033[%dm", fg);
|
||||||
|
tty_puts(tty, s);
|
||||||
|
goto save_fg;
|
||||||
|
}
|
||||||
|
fg -= 90;
|
||||||
|
(*attr) |= GRID_ATTR_BRIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
/* Otherwise set the foreground colour. */
|
/* Otherwise set the foreground colour. */
|
||||||
tty_putcode1(tty, TTYC_SETAF, fg);
|
tty_putcode1(tty, TTYC_SETAF, fg);
|
||||||
|
|
||||||
@ -1330,6 +1344,7 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
{
|
{
|
||||||
struct grid_cell *tc = &tty->cell;
|
struct grid_cell *tc = &tty->cell;
|
||||||
u_char bg = gc->bg;
|
u_char bg = gc->bg;
|
||||||
|
char s[32];
|
||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_BG256) {
|
if (gc->flags & GRID_FLAG_BG256) {
|
||||||
@ -1348,6 +1363,18 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
bg &= 7;
|
bg &= 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Is this an aixterm bright colour? */
|
||||||
|
if (bg >= 100 && bg <= 107) {
|
||||||
|
/* 16 colour terminals or above only. */
|
||||||
|
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {
|
||||||
|
xsnprintf(s, sizeof s, "\033[%dm", bg);
|
||||||
|
tty_puts(tty, s);
|
||||||
|
goto save_bg;
|
||||||
|
}
|
||||||
|
bg -= 100;
|
||||||
|
/* no such thing as a bold background */
|
||||||
|
}
|
||||||
|
|
||||||
/* Otherwise set the background colour. */
|
/* Otherwise set the background colour. */
|
||||||
tty_putcode1(tty, TTYC_SETAB, bg);
|
tty_putcode1(tty, TTYC_SETAB, bg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user