diff --git a/status.c b/status.c index e4836d34..5b625471 100644 --- a/status.c +++ b/status.c @@ -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 792969b3..00a9e8f0 100644 --- a/tmux.c +++ b/tmux.c @@ -345,7 +345,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'); @@ -353,7 +353,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); @@ -383,7 +383,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 d3a4ba1d..cbdbec8d 100644 --- a/tty.c +++ b/tty.c @@ -951,19 +951,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 b1d9192a..4ef003df 100644 --- a/window-choose.c +++ b/window-choose.c @@ -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 340c9c75..7996359d 100644 --- a/window-copy.c +++ b/window-copy.c @@ -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 a3418eb0..9eefd79f 100644 --- a/window-more.c +++ b/window-more.c @@ -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 12249fc1..bdb7d559 100644 --- a/window-scroll.c +++ b/window-scroll.c @@ -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);