aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 19:01:11 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 19:01:11 +0000
commit94471aab827d152375514a8bf69ac2f751e3ca67 (patch)
tree4147ecfa671f43e05695c8355f77f2a4c65fdee0
parent5e55b28d81062f80a785488836bb149e7fedb409 (diff)
downloadrtmux-94471aab827d152375514a8bf69ac2f751e3ca67.tar.gz
rtmux-94471aab827d152375514a8bf69ac2f751e3ca67.tar.bz2
rtmux-94471aab827d152375514a8bf69ac2f751e3ca67.zip
Use reverse rather than background which doesn't show up when terminal doesn't
support colours.
-rw-r--r--CHANGES4
-rw-r--r--clock.c7
-rw-r--r--status.c6
-rw-r--r--tty.c21
4 files changed, 24 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 0545f2db..695f4230 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
19 January 2009
+* Use reverse attributes for clock and cursor, otherwise they do not
+ appear on black and white terminals.
* An error in a command sequence now stops execution of that sequence.
Internally, each command code now passes a return code back rather than
talking to the calling client (if any) directly.
@@ -967,7 +969,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.222 2009-01-19 18:23:40 nicm Exp $
+$Id: CHANGES,v 1.223 2009-01-19 19:01:11 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
diff --git a/clock.c b/clock.c
index f79546d0..df54b290 100644
--- a/clock.c
+++ b/clock.c
@@ -1,4 +1,4 @@
-/* $Id: clock.c,v 1.1 2009-01-11 00:48:42 nicm Exp $ */
+/* $Id: clock.c,v 1.2 2009-01-19 19:01:11 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -113,6 +113,7 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style)
screen_write_clearscreen(ctx);
memcpy(&gc, &grid_default_cell, sizeof gc);
+ gc.fg = colour;
if (screen_size_x(s) < 6 * strlen(tim) || screen_size_y(s) < 6) {
if (screen_size_x(s) >= strlen(tim) && screen_size_y(s) != 0) {
@@ -149,9 +150,9 @@ clock_draw(struct screen_write_ctx *ctx, u_int colour, int style)
screen_write_cursormove(ctx, x, y + j);
for (i = 0; i < 5; i++) {
if (clock_table[idx][j][i])
- gc.bg = colour;
+ gc.attr |= GRID_ATTR_REVERSE;
else
- gc.bg = 0;
+ gc.attr &= ~GRID_ATTR_REVERSE;
screen_write_putc(ctx, &gc, ' ');
}
}
diff --git a/status.c b/status.c
index 9fed1409..a7d0d58f 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.64 2009-01-17 18:47:37 nicm Exp $ */
+/* $Id: status.c,v 1.65 2009-01-19 19:01:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -498,8 +498,8 @@ status_prompt_redraw(struct client *c)
ch = c->prompt_buffer[c->prompt_index];
if (ch == '\0')
ch = ' ';
- gc.bg = gc.fg;
- gc.fg = options_get_number(&s->options, "message-bg");
+ gc.bg = options_get_number(&s->options, "message-bg");
+ gc.attr |= GRID_ATTR_REVERSE;
screen_write_putc(&ctx, &gc, ch);
screen_write_stop(&ctx);
diff --git a/tty.c b/tty.c
index fbeca146..0aee1016 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.61 2009-01-18 21:46:30 nicm Exp $ */
+/* $Id: tty.c,v 1.62 2009-01-19 19:01:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -753,6 +753,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc)
{
struct grid_cell *tc = &tty->cell;
u_char changed;
+ u_int fg, bg;
/* If any bits are being cleared, reset everything. */
if (tc->attr & ~gc->attr)
@@ -763,6 +764,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc)
tc->attr = gc->attr;
/* Set the attributes. */
+ fg = gc->fg;
+ bg = gc->bg;
if (changed & GRID_ATTR_BRIGHT)
tty_putcode(tty, TTYC_BOLD);
if (changed & GRID_ATTR_DIM)
@@ -773,25 +776,29 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc)
tty_putcode(tty, TTYC_SMUL);
if (changed & GRID_ATTR_BLINK)
tty_putcode(tty, TTYC_BLINK);
- if (changed & GRID_ATTR_REVERSE)
- tty_putcode(tty, TTYC_REV);
+ if (changed & GRID_ATTR_REVERSE) {
+ if (tty_term_has(tty->term, TTYC_REV))
+ tty_putcode(tty, TTYC_REV);
+ else if (tty_term_has(tty->term, TTYC_SMSO))
+ tty_putcode(tty, TTYC_SMSO);
+ }
if (changed & GRID_ATTR_HIDDEN)
tty_putcode(tty, TTYC_INVIS);
if (changed & GRID_ATTR_CHARSET)
tty_putcode(tty, TTYC_SMACS);
/* Set foreground colour. */
- if (gc->fg != tc->fg ||
+ if (fg != tc->fg ||
(gc->flags & GRID_FLAG_FG256) != (tc->flags & GRID_FLAG_FG256)) {
tty_attributes_fg(tty, gc);
- tc->fg = gc->fg;
+ tc->fg = fg;
}
/* Set background colour. */
- if (gc->bg != tc->bg ||
+ if (bg != tc->bg ||
(gc->flags & GRID_FLAG_BG256) != (tc->flags & GRID_FLAG_BG256)) {
tty_attributes_bg(tty, gc);
- tc->bg = gc->bg;
+ tc->bg = bg;
}
}