summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-12-14 21:33:39 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-12-14 21:33:39 +0000
commit1081ffa5fe78575fa11ee7aa2ed07cf55a0411db (patch)
treed0f62a26b0cb68e0919eab6e2d337722cc343cd4 /usr.bin
parentc1d04e5481ab2a45629ba5f2d1cb29e7f6d0fe8a (diff)
Pass through the aixterm bright colours if the terminal supports them (>= 16
colours).
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/input.c8
-rw-r--r--usr.bin/tmux/tty.c29
2 files changed, 31 insertions, 6 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 76fd41f26aa..c4991ac5d39 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.24 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.25 2009/12/14 21:33:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1481,8 +1481,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
case 95:
case 96:
case 97:
- gc->flags |= GRID_FLAG_FG256;
- gc->fg = m - 82;
+ gc->fg = m;
break;
case 100:
case 101:
@@ -1492,8 +1491,7 @@ input_handle_sequence_sgr(struct input_ctx *ictx)
case 105:
case 106:
case 107:
- gc->flags |= GRID_FLAG_BG256;
- gc->bg = m - 92;
+ gc->bg = m;
break;
}
}
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 0f0135f5284..85f079ca588 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.78 2009/12/04 11:01:29 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.79 2009/12/14 21:33:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1231,6 +1231,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, u_char *attr)
if (fg == tc->fg && bg == tc->bg &&
((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0)
return;
+ log_debug("fg was %hhu, now %hhu", tc->fg, fg);
/*
* Is either the default colour? This is handled specially because the
@@ -1292,6 +1293,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
{
struct grid_cell *tc = &tty->cell;
u_char fg = gc->fg;
+ char s[32];
/* Is this a 256-colour colour? */
if (gc->flags & GRID_FLAG_FG256) {
@@ -1310,6 +1312,18 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc, u_char *attr)
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. */
tty_putcode1(tty, TTYC_SETAF, fg);
@@ -1325,6 +1339,7 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
{
struct grid_cell *tc = &tty->cell;
u_char bg = gc->bg;
+ char s[32];
/* Is this a 256-colour colour? */
if (gc->flags & GRID_FLAG_BG256) {
@@ -1343,6 +1358,18 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
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. */
tty_putcode1(tty, TTYC_SETAB, bg);