diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-27 20:22:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-27 20:22:33 +0000 |
commit | c6bd9e20635e4acbf8a65409aa9189edaf3cbc89 (patch) | |
tree | b879376b210ca58c82e3d9af88134c0b2c3343f1 /options-cmd.c | |
parent | d697090fa451e9d78b31fdfff89f333d827ddd0a (diff) | |
download | rtmux-c6bd9e20635e4acbf8a65409aa9189edaf3cbc89.tar.gz rtmux-c6bd9e20635e4acbf8a65409aa9189edaf3cbc89.tar.bz2 rtmux-c6bd9e20635e4acbf8a65409aa9189edaf3cbc89.zip |
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!
Diffstat (limited to 'options-cmd.c')
-rw-r--r-- | options-cmd.c | 27 |
1 files changed, 24 insertions, 3 deletions
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 <nicm@users.sourceforge.net> @@ -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; } @@ -99,6 +99,27 @@ set_option_colour(struct cmd_ctx *ctx, struct options *oo, } 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) { |