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!
This commit is contained in:
Nicholas Marriott
2009-01-27 20:22:33 +00:00
parent d697090fa4
commit c6bd9e2063
18 changed files with 222 additions and 46 deletions

View File

@ -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;
}
@ -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)