diff --git a/status.c b/status.c index eb26dd17..16d23765 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.107 2009-07-30 21:14:04 tcunha Exp $ */ +/* $Id: status.c,v 1.108 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -64,8 +64,8 @@ status_redraw(struct client *c) if (gettimeofday(&c->status_timer, NULL) != 0) fatal("gettimeofday"); memcpy(&stdgc, &grid_default_cell, sizeof gc); - stdgc.bg = options_get_number(&s->options, "status-fg"); - stdgc.fg = options_get_number(&s->options, "status-bg"); + stdgc.fg = options_get_number(&s->options, "status-fg"); + stdgc.bg = options_get_number(&s->options, "status-bg"); stdgc.attr |= options_get_number(&s->options, "status-attr"); yy = c->tty.sy - 1; @@ -563,8 +563,8 @@ status_message_redraw(struct client *c) len = c->tty.sx; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.bg = options_get_number(&s->options, "message-fg"); - gc.fg = options_get_number(&s->options, "message-bg"); + gc.fg = options_get_number(&s->options, "message-fg"); + gc.bg = options_get_number(&s->options, "message-bg"); gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); @@ -662,8 +662,8 @@ status_prompt_redraw(struct client *c) len = c->tty.sx; memcpy(&gc, &grid_default_cell, sizeof gc); - gc.bg = options_get_number(&s->options, "message-fg"); - gc.fg = options_get_number(&s->options, "message-bg"); + gc.fg = options_get_number(&s->options, "message-fg"); + gc.bg = options_get_number(&s->options, "message-bg"); gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); diff --git a/tmux.c b/tmux.c index 15ab3b61..f082dfb9 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.155 2009-08-09 16:39:40 tcunha Exp $ */ +/* $Id: tmux.c,v 1.156 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -354,7 +354,7 @@ main(int argc, char **argv) options_set_number(&global_s_options, "display-time", 750); options_set_number(&global_s_options, "history-limit", 2000); options_set_number(&global_s_options, "lock-after-time", 0); - options_set_number(&global_s_options, "message-attr", GRID_ATTR_REVERSE); + options_set_number(&global_s_options, "message-attr", 0); options_set_number(&global_s_options, "message-bg", 3); options_set_number(&global_s_options, "message-fg", 0); options_set_number(&global_s_options, "prefix", '\002'); @@ -362,7 +362,7 @@ main(int argc, char **argv) options_set_number(&global_s_options, "set-remain-on-exit", 0); options_set_number(&global_s_options, "set-titles", 0); options_set_number(&global_s_options, "status", 1); - options_set_number(&global_s_options, "status-attr", GRID_ATTR_REVERSE); + options_set_number(&global_s_options, "status-attr", 0); options_set_number(&global_s_options, "status-bg", 2); options_set_number(&global_s_options, "status-fg", 0); options_set_number(&global_s_options, "status-interval", 15); @@ -392,7 +392,7 @@ main(int argc, char **argv) options_set_number(&global_w_options, "force-width", 0); options_set_number(&global_w_options, "main-pane-width", 81); options_set_number(&global_w_options, "main-pane-height", 24); - options_set_number(&global_w_options, "mode-attr", GRID_ATTR_REVERSE); + options_set_number(&global_w_options, "mode-attr", 0); options_set_number(&global_w_options, "mode-bg", 3); options_set_number(&global_w_options, "mode-fg", 0); options_set_number(&global_w_options, "mode-keys", MODEKEY_EMACS); diff --git a/tty.c b/tty.c index e6998857..d1b75fb1 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.120 2009-08-09 15:26:24 tcunha Exp $ */ +/* $Id: tty.c,v 1.121 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -961,19 +961,33 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc) { struct grid_cell *tc = &tty->cell; u_char changed; - u_int fg, bg; + u_int fg, bg, attr; + + /* + * If no setab, try to use the reverse attribute as a best-effort for a + * non-default background. This is a bit of a hack but it doesn't do + * any serious harm and makes a couple of applications happier. + */ + fg = gc->fg; bg = gc->bg; attr = gc->attr; + if (!tty_term_has(tty->term, TTYC_SETAB)) { + if (attr & GRID_ATTR_REVERSE) { + if (fg != 7 && fg != 8) + attr &= ~GRID_ATTR_REVERSE; + } else { + if (bg != 0 && bg != 8) + attr |= GRID_ATTR_REVERSE; + } + } /* If any bits are being cleared, reset everything. */ - if (tc->attr & ~gc->attr) + if (tc->attr & ~attr) tty_reset(tty); /* Filter out attribute bits already set. */ - changed = gc->attr & ~tc->attr; - tc->attr = gc->attr; + changed = attr & ~tc->attr; + tc->attr = 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) diff --git a/window-choose.c b/window-choose.c index 9c6931da..6bea76ea 100644 --- a/window-choose.c +++ b/window-choose.c @@ -1,4 +1,4 @@ -/* $Id: window-choose.c,v 1.21 2009-07-30 20:32:05 tcunha Exp $ */ +/* $Id: window-choose.c,v 1.22 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -305,8 +305,8 @@ window_choose_write_line( utf8flag = options_get_number(&wp->window->options, "utf8"); memcpy(&gc, &grid_default_cell, sizeof gc); if (data->selected == data->top + py) { - gc.fg = options_get_number(&wp->window->options, "mode-bg"); - gc.bg = options_get_number(&wp->window->options, "mode-fg"); + gc.fg = options_get_number(&wp->window->options, "mode-fg"); + gc.bg = options_get_number(&wp->window->options, "mode-bg"); gc.attr |= options_get_number(&wp->window->options, "mode-attr"); } diff --git a/window-copy.c b/window-copy.c index 58ea727c..d6b33116 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1,4 +1,4 @@ -/* $Id: window-copy.c,v 1.72 2009-07-30 20:32:05 tcunha Exp $ */ +/* $Id: window-copy.c,v 1.73 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -264,8 +264,8 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_i memcpy(&gc, &grid_default_cell, sizeof gc); size = xsnprintf(hdr, sizeof hdr, "[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base)); - gc.bg = options_get_number(&wp->window->options, "mode-fg"); - gc.fg = options_get_number(&wp->window->options, "mode-bg"); + gc.fg = options_get_number(&wp->window->options, "mode-fg"); + gc.bg = options_get_number(&wp->window->options, "mode-bg"); gc.attr |= options_get_number(&wp->window->options, "mode-attr"); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); screen_write_puts(ctx, &gc, "%s", hdr); @@ -368,8 +368,8 @@ window_copy_update_selection(struct window_pane *wp) /* Set colours. */ memcpy(&gc, &grid_default_cell, sizeof gc); - gc.bg = options_get_number(&wp->window->options, "mode-fg"); - gc.fg = options_get_number(&wp->window->options, "mode-bg"); + gc.fg = options_get_number(&wp->window->options, "mode-fg"); + gc.bg = options_get_number(&wp->window->options, "mode-bg"); gc.attr |= options_get_number(&wp->window->options, "mode-attr"); /* Find top-left of screen. */ diff --git a/window-more.c b/window-more.c index 7afcf6ca..f0e611d7 100644 --- a/window-more.c +++ b/window-more.c @@ -1,4 +1,4 @@ -/* $Id: window-more.c,v 1.35 2009-07-28 23:11:18 tcunha Exp $ */ +/* $Id: window-more.c,v 1.36 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -176,8 +176,8 @@ window_more_write_line( size = xsnprintf(hdr, sizeof hdr, "[%u/%u]", data->top, ARRAY_LENGTH(&data->list)); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); - gc.bg = options_get_number(&wp->window->options, "mode-fg"); - gc.fg = options_get_number(&wp->window->options, "mode-bg"); + gc.fg = options_get_number(&wp->window->options, "mode-fg"); + gc.bg = options_get_number(&wp->window->options, "mode-bg"); gc.attr |= options_get_number(&wp->window->options, "mode-attr"); screen_write_puts(ctx, &gc, "%s", hdr); memcpy(&gc, &grid_default_cell, sizeof gc); diff --git a/window-scroll.c b/window-scroll.c index 08628de3..e8951fc6 100644 --- a/window-scroll.c +++ b/window-scroll.c @@ -1,4 +1,4 @@ -/* $Id: window-scroll.c,v 1.37 2009-07-28 23:11:18 tcunha Exp $ */ +/* $Id: window-scroll.c,v 1.38 2009-08-09 16:50:57 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -176,8 +176,8 @@ window_scroll_write_line( memcpy(&gc, &grid_default_cell, sizeof gc); size = xsnprintf(hdr, sizeof hdr, "[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base)); - gc.bg = options_get_number(&wp->window->options, "mode-fg"); - gc.fg = options_get_number(&wp->window->options, "mode-bg"); + gc.fg = options_get_number(&wp->window->options, "mode-fg"); + gc.bg = options_get_number(&wp->window->options, "mode-bg"); gc.attr |= options_get_number(&wp->window->options, "mode-attr"); screen_write_cursormove(ctx, screen_size_x(s) - size, 0); screen_write_puts(ctx, &gc, "%s", hdr);