mirror of
https://github.com/tmux/tmux.git
synced 2024-11-08 04:08:49 +00:00
Use reverse so status line etc works in terminals w/o colour.
This commit is contained in:
parent
d2cfbc64a0
commit
6146cab3bd
37
status.c
37
status.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: status.c,v 1.66 2009-01-19 20:14:55 nicm Exp $ */
|
/* $Id: status.c,v 1.67 2009-01-23 20:49:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -67,8 +67,9 @@ status_redraw(struct client *c)
|
|||||||
if (gettimeofday(&c->status_timer, NULL) != 0)
|
if (gettimeofday(&c->status_timer, NULL) != 0)
|
||||||
fatal("gettimeofday");
|
fatal("gettimeofday");
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
gc.fg = options_get_number(&s->options, "status-fg");
|
gc.bg = options_get_number(&s->options, "status-fg");
|
||||||
gc.bg = options_get_number(&s->options, "status-bg");
|
gc.fg = options_get_number(&s->options, "status-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
|
|
||||||
yy = c->sy - 1;
|
yy = c->sy - 1;
|
||||||
if (yy == 0)
|
if (yy == 0)
|
||||||
@ -198,7 +199,7 @@ draw:
|
|||||||
rarrow = -1;
|
rarrow = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gc.attr &= ~GRID_ATTR_REVERSE;
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
if (offset < start + width) {
|
if (offset < start + width) {
|
||||||
if (offset >= start) {
|
if (offset >= start) {
|
||||||
screen_write_putc(&ctx, &gc, ' ');
|
screen_write_putc(&ctx, &gc, ' ');
|
||||||
@ -222,9 +223,9 @@ draw:
|
|||||||
/* Draw the arrows. */
|
/* Draw the arrows. */
|
||||||
if (larrow != 0) {
|
if (larrow != 0) {
|
||||||
if (larrow == -1)
|
if (larrow == -1)
|
||||||
gc.attr |= GRID_ATTR_REVERSE;
|
|
||||||
else
|
|
||||||
gc.attr &= ~GRID_ATTR_REVERSE;
|
gc.attr &= ~GRID_ATTR_REVERSE;
|
||||||
|
else
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
if (llen != 0)
|
if (llen != 0)
|
||||||
screen_write_cursormove(&ctx, llen + 1, yy);
|
screen_write_cursormove(&ctx, llen + 1, yy);
|
||||||
else
|
else
|
||||||
@ -234,15 +235,15 @@ draw:
|
|||||||
}
|
}
|
||||||
if (rarrow != 0) {
|
if (rarrow != 0) {
|
||||||
if (rarrow == -1)
|
if (rarrow == -1)
|
||||||
gc.attr |= GRID_ATTR_REVERSE;
|
|
||||||
else
|
|
||||||
gc.attr &= ~GRID_ATTR_REVERSE;
|
gc.attr &= ~GRID_ATTR_REVERSE;
|
||||||
|
else
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
if (rlen != 0)
|
if (rlen != 0)
|
||||||
screen_write_cursormove(&ctx, c->sx - rlen - 2, yy);
|
screen_write_cursormove(&ctx, c->sx - rlen - 2, yy);
|
||||||
else
|
else
|
||||||
screen_write_cursormove(&ctx, c->sx - 1, yy);
|
screen_write_cursormove(&ctx, c->sx - 1, yy);
|
||||||
screen_write_putc(&ctx, &gc, '>');
|
screen_write_putc(&ctx, &gc, '>');
|
||||||
gc.attr &= ~GRID_ATTR_REVERSE;
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
@ -388,14 +389,13 @@ status_print(struct session *s, struct winlink *wl, struct grid_cell *gc)
|
|||||||
if (wl == s->curw)
|
if (wl == s->curw)
|
||||||
flag = '*';
|
flag = '*';
|
||||||
|
|
||||||
gc->attr &= ~GRID_ATTR_REVERSE;
|
|
||||||
if (session_alert_has(s, wl, WINDOW_ACTIVITY)) {
|
if (session_alert_has(s, wl, WINDOW_ACTIVITY)) {
|
||||||
flag = '#';
|
flag = '#';
|
||||||
gc->attr |= GRID_ATTR_REVERSE;
|
gc->attr &= ~GRID_ATTR_REVERSE;
|
||||||
}
|
}
|
||||||
if (session_alert_has(s, wl, WINDOW_BELL)) {
|
if (session_alert_has(s, wl, WINDOW_BELL)) {
|
||||||
flag = '!';
|
flag = '!';
|
||||||
gc->attr |= GRID_ATTR_REVERSE;
|
gc->attr &= ~GRID_ATTR_REVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
xasprintf(&text, "%d:%s%c", wl->idx, wl->window->name, flag);
|
xasprintf(&text, "%d:%s%c", wl->idx, wl->window->name, flag);
|
||||||
@ -423,8 +423,9 @@ status_message_redraw(struct client *c)
|
|||||||
len = c->sx;
|
len = c->sx;
|
||||||
|
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
gc.fg = options_get_number(&s->options, "message-fg");
|
gc.bg = options_get_number(&s->options, "message-fg");
|
||||||
gc.bg = options_get_number(&s->options, "message-bg");
|
gc.fg = options_get_number(&s->options, "message-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
|
|
||||||
screen_write_start(&ctx, NULL, &c->status);
|
screen_write_start(&ctx, NULL, &c->status);
|
||||||
|
|
||||||
@ -459,8 +460,9 @@ status_prompt_redraw(struct client *c)
|
|||||||
len = c->sx;
|
len = c->sx;
|
||||||
|
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
gc.fg = options_get_number(&s->options, "message-fg");
|
gc.bg = options_get_number(&s->options, "message-fg");
|
||||||
gc.bg = options_get_number(&s->options, "message-bg");
|
gc.fg = options_get_number(&s->options, "message-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
|
|
||||||
screen_write_start(&ctx, NULL, &c->status);
|
screen_write_start(&ctx, NULL, &c->status);
|
||||||
|
|
||||||
@ -500,8 +502,7 @@ status_prompt_redraw(struct client *c)
|
|||||||
ch = c->prompt_buffer[c->prompt_index];
|
ch = c->prompt_buffer[c->prompt_index];
|
||||||
if (ch == '\0')
|
if (ch == '\0')
|
||||||
ch = ' ';
|
ch = ' ';
|
||||||
gc.bg = options_get_number(&s->options, "message-bg");
|
gc.attr &= ~GRID_ATTR_REVERSE;
|
||||||
gc.attr |= GRID_ATTR_REVERSE;
|
|
||||||
screen_write_putc(&ctx, &gc, ch);
|
screen_write_putc(&ctx, &gc, ch);
|
||||||
|
|
||||||
screen_write_stop(&ctx);
|
screen_write_stop(&ctx);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-choose.c,v 1.5 2009-01-23 20:17:04 nicm Exp $ */
|
/* $Id: window-choose.c,v 1.6 2009-01-23 20:49:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -258,8 +258,9 @@ window_choose_write_line(
|
|||||||
|
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
if (data->selected == data->top + py) {
|
if (data->selected == data->top + py) {
|
||||||
gc.fg = options_get_number(&wp->window->options, "mode-fg");
|
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
||||||
gc.bg = options_get_number(&wp->window->options, "mode-bg");
|
gc.bg = options_get_number(&wp->window->options, "mode-fg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_write_cursormove(ctx, 0, py);
|
screen_write_cursormove(ctx, 0, py);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-copy.c,v 1.42 2009-01-21 18:19:32 nicm Exp $ */
|
/* $Id: window-copy.c,v 1.43 2009-01-23 20:49:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -215,8 +215,9 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_i
|
|||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
size = xsnprintf(hdr, sizeof hdr,
|
size = xsnprintf(hdr, sizeof hdr,
|
||||||
"[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base));
|
"[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base));
|
||||||
gc.fg = options_get_number(&wp->window->options, "mode-fg");
|
gc.bg = options_get_number(&wp->window->options, "mode-fg");
|
||||||
gc.bg = options_get_number(&wp->window->options, "mode-bg");
|
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
||||||
screen_write_puts(ctx, &gc, "%s", hdr);
|
screen_write_puts(ctx, &gc, "%s", hdr);
|
||||||
screen_write_puts(ctx, &gc, "%s", hdr);
|
screen_write_puts(ctx, &gc, "%s", hdr);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-more.c,v 1.25 2009-01-15 00:51:39 nicm Exp $ */
|
/* $Id: window-more.c,v 1.26 2009-01-23 20:49:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -180,8 +180,9 @@ window_more_write_line(
|
|||||||
size = xsnprintf(hdr, sizeof hdr,
|
size = xsnprintf(hdr, sizeof hdr,
|
||||||
"[%u/%u]", data->top, ARRAY_LENGTH(&data->list));
|
"[%u/%u]", data->top, ARRAY_LENGTH(&data->list));
|
||||||
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
||||||
gc.fg = options_get_number(&wp->window->options, "mode-fg");
|
gc.bg = options_get_number(&wp->window->options, "mode-fg");
|
||||||
gc.bg = options_get_number(&wp->window->options, "mode-bg");
|
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
screen_write_puts(ctx, &gc, "%s", hdr);
|
screen_write_puts(ctx, &gc, "%s", hdr);
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
} else
|
} else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-scroll.c,v 1.27 2009-01-11 23:31:46 nicm Exp $ */
|
/* $Id: window-scroll.c,v 1.28 2009-01-23 20:49:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -158,8 +158,9 @@ window_scroll_write_line(
|
|||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
size = xsnprintf(hdr, sizeof hdr,
|
size = xsnprintf(hdr, sizeof hdr,
|
||||||
"[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base));
|
"[%u,%u/%u]", data->ox, data->oy, screen_hsize(&wp->base));
|
||||||
gc.fg = options_get_number(&wp->window->options, "mode-fg");
|
gc.bg = options_get_number(&wp->window->options, "mode-fg");
|
||||||
gc.bg = options_get_number(&wp->window->options, "mode-bg");
|
gc.fg = options_get_number(&wp->window->options, "mode-bg");
|
||||||
|
gc.attr |= GRID_ATTR_REVERSE;
|
||||||
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
|
||||||
screen_write_puts(ctx, &gc, "%s", hdr);
|
screen_write_puts(ctx, &gc, "%s", hdr);
|
||||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||||
|
Loading…
Reference in New Issue
Block a user