diff --git a/CHANGES b/CHANGES index fcc7e7fb..ec05ed39 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +27 January 2009 + +* Allow status, mode and message attributes to be changed by three new options: + status-attr, mode-attr, message-attr. A comma-separataed list is accepted + containing: bright, dim, underscore, blink, reverse, hidden, italics, for + example: + + set -g status-attr bright,blink + + From Josh Elsasser, thanks! + 26 January 2009 * Be more clever about picking the right process to create the window name. @@ -1014,7 +1025,7 @@ (including mutt, emacs). No status bar yet and no key remapping or other customisation. -$Id: CHANGES,v 1.236 2009-01-26 22:57:18 nicm Exp $ +$Id: CHANGES,v 1.237 2009-01-27 20:22:33 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/GNUmakefile b/GNUmakefile index e7f53913..4800482b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,4 +1,4 @@ -# $Id: GNUmakefile,v 1.67 2009-01-25 19:00:10 tcunha Exp $ +# $Id: GNUmakefile,v 1.68 2009-01-27 20:22:33 nicm Exp $ .PHONY: clean @@ -42,7 +42,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \ options.c options-cmd.c paste.c colour.c utf8.c clock.c \ tty.c tty-term.c tty-keys.c tty-write.c util.c names.c \ osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \ - osdep-darwin.c + osdep-darwin.c attributes.c CC?= gcc INCDIRS+= -I. -I- diff --git a/Makefile b/Makefile index a5d3eee7..a69e80e9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.106 2009-01-25 19:00:10 tcunha Exp $ +# $Id: Makefile,v 1.107 2009-01-27 20:22:33 nicm Exp $ .SUFFIXES: .c .o .y .h .PHONY: clean update-index.html upload-index.html @@ -45,7 +45,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \ options.c options-cmd.c paste.c colour.c utf8.c clock.c \ tty.c tty-term.c tty-keys.c tty-write.c util.c names.c \ osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \ - osdep-darwin.c + osdep-darwin.c attributes.c CC?= cc INCDIRS+= -I. -I- -I/usr/local/include diff --git a/attributes.c b/attributes.c new file mode 100644 index 00000000..24744481 --- /dev/null +++ b/attributes.c @@ -0,0 +1,92 @@ +/* $Id: attributes.c,v 1.1 2009-01-27 20:22:33 nicm Exp $ */ + +/* + * Copyright (c) 2009 Joshua Elsasser + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include + +#include "tmux.h" + +const char * +attributes_tostring(u_char ch) +{ + static char buf[128]; + + if (ch == 0) + return ("default"); + + buf[0] = '\0'; + if (ch & GRID_ATTR_BRIGHT) + strlcat(buf, "bright,", sizeof (buf)); + if (ch & GRID_ATTR_DIM) + strlcat(buf, "dim,", sizeof (buf)); + if (ch & GRID_ATTR_UNDERSCORE) + strlcat(buf, "underscore,", sizeof (buf)); + if (ch & GRID_ATTR_BLINK) + strlcat(buf, "blink,", sizeof (buf)); + if (ch & GRID_ATTR_REVERSE) + strlcat(buf, "reverse,", sizeof (buf)); + if (ch & GRID_ATTR_HIDDEN) + strlcat(buf, "hidden,", sizeof (buf)); + if (ch & GRID_ATTR_ITALICS) + strlcat(buf, "italics,", sizeof (buf)); + *(strrchr(buf, ',')) = '\0'; + + return (buf); +} + +int +attributes_fromstring(const char *str) +{ + const char delimiters[] = " ,|"; + u_char ch; + size_t end; + + if (*str == '\0' || strcspn(str, delimiters) == 0) + return (-1); + if (strchr(delimiters, str[strlen(str) - 1]) != NULL) + return (-1); + + if (strcasecmp(str, "default") == 0) + return (0); + + ch = 0; + do { + end = strcspn(str, delimiters); + if ((end == 6 && strncasecmp(str, "bright", end) == 0) || + (end == 4 && strncasecmp(str, "bold", end) == 0)) + ch |= GRID_ATTR_BRIGHT; + else if (end == 3 && strncasecmp(str, "dim", end) == 0) + ch |= GRID_ATTR_DIM; + else if (end == 10 && strncasecmp(str, "underscore", end) == 0) + ch |= GRID_ATTR_UNDERSCORE; + else if (end == 5 && strncasecmp(str, "blink", end) == 0) + ch |= GRID_ATTR_BLINK; + else if (end == 7 && strncasecmp(str, "reverse", end) == 0) + ch |= GRID_ATTR_REVERSE; + else if (end == 6 && strncasecmp(str, "hidden", end) == 0) + ch |= GRID_ATTR_HIDDEN; + else if (end == 7 && strncasecmp(str, "italics", end) == 0) + ch |= GRID_ATTR_ITALICS; + else + return (-1); + str += end + strspn(str + end, delimiters); + } while (*str != '\0'); + + return (ch); +} diff --git a/cmd-set-option.c b/cmd-set-option.c index 0b0f21b7..c7940639 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.56 2009-01-23 20:48:19 nicm Exp $ */ +/* $Id: cmd-set-option.c,v 1.57 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -53,12 +53,14 @@ const struct set_option_entry set_option_table[NSETOPTION] = { { "display-time", SET_OPTION_NUMBER, 1, INT_MAX, NULL }, { "history-limit", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, { "lock-after-time", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, + { "message-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "message-bg", SET_OPTION_COLOUR, 0, 0, NULL }, { "message-fg", SET_OPTION_COLOUR, 0, 0, NULL }, { "prefix", SET_OPTION_KEY, 0, 0, NULL }, { "repeat-time", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL }, { "set-titles", SET_OPTION_FLAG, 0, 0, NULL }, { "status", SET_OPTION_FLAG, 0, 0, NULL }, + { "status-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "status-bg", SET_OPTION_COLOUR, 0, 0, NULL }, { "status-fg", SET_OPTION_COLOUR, 0, 0, NULL }, { "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, @@ -143,6 +145,9 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx) case SET_OPTION_COLOUR: set_option_colour(ctx, oo, entry, data->value); break; + case SET_OPTION_ATTRIBUTES: + set_option_attributes(ctx, oo, entry, data->value); + break; case SET_OPTION_FLAG: set_option_flag(ctx, oo, entry, data->value); break; diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c index 9dbb4d5d..08b6ebdd 100644 --- a/cmd-set-window-option.c +++ b/cmd-set-window-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-window-option.c,v 1.22 2009-01-20 19:35:03 nicm Exp $ */ +/* $Id: cmd-set-window-option.c,v 1.23 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -61,6 +61,7 @@ const struct set_option_entry set_window_option_table[NSETWINDOWOPTION] = { SET_OPTION_CHOICE, 0, 0, set_option_clock_mode_style_list }, { "force-height", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, { "force-width", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, + { "mode-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "mode-bg", SET_OPTION_COLOUR, 0, 0, NULL }, { "mode-fg", SET_OPTION_COLOUR, 0, 0, NULL }, { "mode-keys", SET_OPTION_CHOICE, 0, 0, set_option_mode_keys_list }, @@ -145,6 +146,9 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx) case SET_OPTION_COLOUR: set_option_colour(ctx, oo, entry, data->value); break; + case SET_OPTION_ATTRIBUTES: + set_option_attributes(ctx, oo, entry, data->value); + break; case SET_OPTION_FLAG: set_option_flag(ctx, oo, entry, data->value); break; diff --git a/cmd-show-options.c b/cmd-show-options.c index e88d8ac8..4fb8f804 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $Id: cmd-show-options.c,v 1.10 2009-01-19 18:23:40 nicm Exp $ */ +/* $Id: cmd-show-options.c,v 1.11 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -86,6 +86,11 @@ cmd_show_options_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->print(ctx, "%s %s", entry->name, colour_tostring(vn)); break; + case SET_OPTION_ATTRIBUTES: + vn = options_get_number(oo, entry->name); + ctx->print(ctx, "%s %s", + entry->name, attributes_tostring(vn)); + break; case SET_OPTION_FLAG: vn = options_get_number(oo, entry->name); if (vn) diff --git a/cmd-show-window-options.c b/cmd-show-window-options.c index 0af1311b..ca7f900e 100644 --- a/cmd-show-window-options.c +++ b/cmd-show-window-options.c @@ -1,4 +1,4 @@ -/* $Id: cmd-show-window-options.c,v 1.6 2009-01-19 18:23:40 nicm Exp $ */ +/* $Id: cmd-show-window-options.c,v 1.7 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -86,6 +86,11 @@ cmd_show_window_options_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->print(ctx, "%s %s", entry->name, colour_tostring(vn)); break; + case SET_OPTION_ATTRIBUTES: + vn = options_get_number(oo, entry->name); + ctx->print(ctx, "%s %s", + entry->name, attributes_tostring(vn)); + break; case SET_OPTION_FLAG: vn = options_get_number(oo, entry->name); if (vn) diff --git a/colour.c b/colour.c index f1f841d5..497f157b 100644 --- a/colour.c +++ b/colour.c @@ -1,4 +1,4 @@ -/* $Id: colour.c,v 1.3 2009-01-10 01:51:21 nicm Exp $ */ +/* $Id: colour.c,v 1.4 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -49,7 +49,7 @@ colour_tostring(u_char c) } /* String to colour. */ -u_char +int colour_fromstring(const char *s) { if (strcasecmp(s, "black") == 0 || (s[0] == '0' && s[1] == '\0')) @@ -70,7 +70,7 @@ colour_fromstring(const char *s) return (7); if (strcasecmp(s, "default") == 0 || (s[0] == '8' && s[1] == '\0')) return (8); - return (255); + return (-1); } u_char diff --git a/options-cmd.c b/options-cmd.c index b31754e7..2c1ab636 100644 --- a/options-cmd.c +++ b/options-cmd.c @@ -1,4 +1,4 @@ -/* $Id: options-cmd.c,v 1.3 2009-01-10 01:51:22 nicm Exp $ */ +/* $Id: options-cmd.c,v 1.4 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -81,14 +81,14 @@ void set_option_colour(struct cmd_ctx *ctx, struct options *oo, const struct set_option_entry *entry, char *value) { - u_char colour; + int colour; if (value == NULL) { ctx->error(ctx, "empty value"); return; } - if ((colour = colour_fromstring(value)) > 8) { + if ((colour = colour_fromstring(value)) == -1) { ctx->error(ctx, "bad colour: %s", value); return; } @@ -98,6 +98,27 @@ set_option_colour(struct cmd_ctx *ctx, struct options *oo, "set option: %s -> %s", entry->name, colour_tostring(colour)); } +void +set_option_attributes(struct cmd_ctx *ctx, struct options *oo, + const struct set_option_entry *entry, char *value) +{ + int attr; + + if (value == NULL) { + ctx->error(ctx, "empty value"); + return; + } + + if ((attr = attributes_fromstring(value)) == -1) { + ctx->error(ctx, "bad attributes: %s", value); + return; + } + + options_set_number(oo, entry->name, attr); + ctx->info(ctx, + "set option: %s -> %s", entry->name, attributes_tostring(attr)); +} + void set_option_flag(struct cmd_ctx *ctx, struct options *oo, const struct set_option_entry *entry, char *value) diff --git a/status.c b/status.c index 5712d2f2..e1088488 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.67 2009-01-23 20:49:01 nicm Exp $ */ +/* $Id: status.c,v 1.68 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -50,6 +50,7 @@ status_redraw(struct client *c) size_t size, start, width; struct grid_cell gc; int larrow, rarrow; + u_char stdattr, revattr; left = right = NULL; @@ -69,7 +70,9 @@ status_redraw(struct client *c) memcpy(&gc, &grid_default_cell, sizeof gc); gc.bg = options_get_number(&s->options, "status-fg"); gc.fg = options_get_number(&s->options, "status-bg"); - gc.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&s->options, "status-attr"); + stdattr = gc.attr; + revattr = gc.attr ^ GRID_ATTR_REVERSE; yy = c->sy - 1; if (yy == 0) @@ -199,7 +202,7 @@ draw: rarrow = -1; } - gc.attr |= GRID_ATTR_REVERSE; + gc.attr = stdattr; if (offset < start + width) { if (offset >= start) { screen_write_putc(&ctx, &gc, ' '); @@ -223,27 +226,27 @@ draw: /* Draw the arrows. */ if (larrow != 0) { if (larrow == -1) - gc.attr &= ~GRID_ATTR_REVERSE; + gc.attr = revattr; else - gc.attr |= GRID_ATTR_REVERSE; + gc.attr = stdattr; if (llen != 0) screen_write_cursormove(&ctx, llen + 1, yy); else screen_write_cursormove(&ctx, 0, yy); screen_write_putc(&ctx, &gc, '<'); - gc.attr &= ~GRID_ATTR_REVERSE; + gc.attr = revattr; } if (rarrow != 0) { if (rarrow == -1) - gc.attr &= ~GRID_ATTR_REVERSE; + gc.attr = revattr; else - gc.attr |= GRID_ATTR_REVERSE; + gc.attr = stdattr; if (rlen != 0) screen_write_cursormove(&ctx, c->sx - rlen - 2, yy); else screen_write_cursormove(&ctx, c->sx - 1, yy); screen_write_putc(&ctx, &gc, '>'); - gc.attr |= GRID_ATTR_REVERSE; + gc.attr = stdattr; } goto out; @@ -391,11 +394,11 @@ status_print(struct session *s, struct winlink *wl, struct grid_cell *gc) if (session_alert_has(s, wl, WINDOW_ACTIVITY)) { flag = '#'; - gc->attr &= ~GRID_ATTR_REVERSE; + gc->attr ^= GRID_ATTR_REVERSE; } if (session_alert_has(s, wl, WINDOW_BELL)) { flag = '!'; - gc->attr &= ~GRID_ATTR_REVERSE; + gc->attr ^= GRID_ATTR_REVERSE; } xasprintf(&text, "%d:%s%c", wl->idx, wl->window->name, flag); @@ -425,7 +428,7 @@ status_message_redraw(struct client *c) 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.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); @@ -462,7 +465,7 @@ status_prompt_redraw(struct client *c) 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.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&s->options, "message-attr"); screen_write_start(&ctx, NULL, &c->status); @@ -502,7 +505,7 @@ status_prompt_redraw(struct client *c) ch = c->prompt_buffer[c->prompt_index]; if (ch == '\0') ch = ' '; - gc.attr &= ~GRID_ATTR_REVERSE; + gc.attr ^= GRID_ATTR_REVERSE; screen_write_putc(&ctx, &gc, ch); screen_write_stop(&ctx); diff --git a/tmux.1 b/tmux.1 index 01506c8e..ed691920 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.70 2009-01-26 18:22:55 nicm Exp $ +.\" $Id: tmux.1,v 1.71 2009-01-27 20:22:33 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -789,6 +789,22 @@ or .Ic default . .It Ic message-fg Ar colour Set status line message foreground colour. +.It Ic message-attr Ar attributes +Set status line message attributes, where +.Ar attributes +is either +.Ic default +or a comma-delimited list of one or more of: +.Ic bright +(or +.Ic bold ) , +.Ic dim , +.Ic underscore , +.Ic blink , +.Ic reverse , +.Ic hidden , +or +.Ic italics . .It Ic prefix Ar key Set the current prefix key. .It Ic repeat-time Ar number @@ -821,6 +837,8 @@ Show or hide the status line. Set status line background colour. .It Ic status-fg Ar colour Set status line foreground colour. +.It Ic status-attr Ar attributes +Set status line attributes. .It Ic status-interval Ar interval Update the status bar every .Ar interval @@ -930,6 +948,8 @@ A value of zero restores the default unlimited setting. Set window modes background colour. .It Ic mode-fg Ar colour Set window modes foreground colour. +.It Ic mode-attr Ar attributes +Set window modes attributes. .It Xo Ic mode-keys .Op Ic vi | Ic emacs .Xc diff --git a/tmux.c b/tmux.c index 31bd68cb..4be9ae82 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.102 2009-01-23 16:19:56 nicm Exp $ */ +/* $Id: tmux.c,v 1.103 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -237,6 +237,7 @@ main(int argc, char **argv) options_set_number(&global_options, "history-limit", 2000); options_set_number(&global_options, "message-bg", 3); options_set_number(&global_options, "message-fg", 0); + options_set_number(&global_options, "message-attr", GRID_ATTR_REVERSE); options_set_number(&global_options, "prefix", META); options_set_number(&global_options, "repeat-time", 500); options_set_number(&global_options, "set-titles", 1); @@ -244,6 +245,7 @@ main(int argc, char **argv) options_set_number(&global_options, "status", 1); options_set_number(&global_options, "status-bg", 2); options_set_number(&global_options, "status-fg", 0); + options_set_number(&global_options, "status-attr", GRID_ATTR_REVERSE); options_set_number(&global_options, "status-interval", 15); options_set_number(&global_options, "status-left-length", 10); options_set_number(&global_options, "status-right-length", 40); @@ -259,6 +261,7 @@ main(int argc, char **argv) options_set_number(&global_window_options, "automatic-rename", 1); options_set_number(&global_window_options, "mode-bg", 3); options_set_number(&global_window_options, "mode-fg", 0); + options_set_number(&global_window_options, "mode-attr", GRID_ATTR_REVERSE); options_set_number(&global_window_options, "mode-keys", MODEKEY_EMACS); options_set_number(&global_window_options, "monitor-activity", 0); options_set_number(&global_window_options, "utf8", 0); diff --git a/tmux.h b/tmux.h index 45c00102..eac6f739 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.251 2009-01-26 22:57:19 nicm Exp $ */ +/* $Id: tmux.h,v 1.252 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -461,13 +461,13 @@ struct options_entry { OPTIONS_STRING, OPTIONS_NUMBER, OPTIONS_KEY, - OPTIONS_COLOURS + OPTIONS_COLOURS, + OPTIONS_ATTRIBUTES } type; union { char *string; long long number; int key; - u_char colours; } value; SPLAY_ENTRY(options_entry) entry; @@ -899,6 +899,7 @@ struct set_option_entry { SET_OPTION_NUMBER, SET_OPTION_KEY, SET_OPTION_COLOUR, + SET_OPTION_ATTRIBUTES, SET_OPTION_FLAG, SET_OPTION_CHOICE } type; @@ -910,8 +911,8 @@ struct set_option_entry { }; extern const struct set_option_entry set_option_table[]; extern const struct set_option_entry set_window_option_table[]; -#define NSETOPTION 20 -#define NSETWINDOWOPTION 13 +#define NSETOPTION 22 +#define NSETWINDOWOPTION 14 /* Edit keys. */ enum mode_key { @@ -1062,6 +1063,8 @@ void set_option_key(struct cmd_ctx *, struct options *, const struct set_option_entry *, char *); void set_option_colour(struct cmd_ctx *, struct options *, const struct set_option_entry *, char *); +void set_option_attributes(struct cmd_ctx *, + struct options *, const struct set_option_entry *, char *); void set_option_flag(struct cmd_ctx *, struct options *, const struct set_option_entry *, char *); void set_option_choice(struct cmd_ctx *, @@ -1307,9 +1310,13 @@ void input_key(struct window_pane *, int); /* colour.c */ const char *colour_tostring(u_char); -u_char colour_fromstring(const char *); +int colour_fromstring(const char *); u_char colour_translate256(u_char); +/* attributes.c */ +const char *attributes_tostring(u_char); +int attributes_fromstring(const char *); + /* grid.c */ extern const struct grid_cell grid_default_cell; struct grid_data *grid_create(u_int, u_int, u_int); diff --git a/window-choose.c b/window-choose.c index 38a6a9dc..f865b156 100644 --- a/window-choose.c +++ b/window-choose.c @@ -1,4 +1,4 @@ -/* $Id: window-choose.c,v 1.6 2009-01-23 20:49:01 nicm Exp $ */ +/* $Id: window-choose.c,v 1.7 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -260,7 +260,7 @@ window_choose_write_line( 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.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&wp->window->options, "mode-attr"); } screen_write_cursormove(ctx, 0, py); diff --git a/window-copy.c b/window-copy.c index 186392e8..5430384b 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1,4 +1,4 @@ -/* $Id: window-copy.c,v 1.45 2009-01-25 18:51:28 tcunha Exp $ */ +/* $Id: window-copy.c,v 1.46 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -217,7 +217,7 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_i "[%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.attr |= GRID_ATTR_REVERSE; + 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); screen_write_puts(ctx, &gc, "%s", hdr); @@ -322,7 +322,7 @@ window_copy_update_selection(struct window_pane *wp) 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.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&wp->window->options, "mode-attr"); /* Find top-left of screen. */ tx = data->ox; diff --git a/window-more.c b/window-more.c index de3386ef..7cbf0004 100644 --- a/window-more.c +++ b/window-more.c @@ -1,4 +1,4 @@ -/* $Id: window-more.c,v 1.26 2009-01-23 20:49:01 nicm Exp $ */ +/* $Id: window-more.c,v 1.27 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -182,7 +182,7 @@ window_more_write_line( 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.attr |= GRID_ATTR_REVERSE; + gc.attr |= options_get_number(&wp->window->options, "mode-attr"); screen_write_puts(ctx, &gc, "%s", hdr); memcpy(&gc, &grid_default_cell, sizeof gc); } else diff --git a/window-scroll.c b/window-scroll.c index f874d1d9..bdcba248 100644 --- a/window-scroll.c +++ b/window-scroll.c @@ -1,4 +1,4 @@ -/* $Id: window-scroll.c,v 1.28 2009-01-23 20:49:01 nicm Exp $ */ +/* $Id: window-scroll.c,v 1.29 2009-01-27 20:22:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -160,7 +160,7 @@ window_scroll_write_line( "[%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.attr |= GRID_ATTR_REVERSE; + 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); memcpy(&gc, &grid_default_cell, sizeof gc);