From cfb363b18ca3394bd07428fde7ae63b5dd84d6c4 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 13 Apr 2009 17:34:14 +0200 Subject: [PATCH] Allow multiple text attributes for color commands This also fixes lazy behavior so that setting the cursor color no longer automatically sets the text to bold. --- NEWS | 8 ++++++++ tig.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index cf56f49..492255f 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,11 @@ Release notes tig master --------- +Incompatibilities: + + - Setting the cursor color no longer automatically sets the text to + bold. The old 'lazy' behavior was a bug. + Improvements: - Add branch view for choosing which branch to display in the main @@ -14,6 +19,9 @@ Improvements: - Make height of the lower view in a split view configurable by setting the 'split-view-height' variable to a number or a percentage. Defaults to 2/3 of the total view height. + - Allow multiple text attributes for color commands: + + color cursor white blue underline bold Bug fixes: diff --git a/tig.c b/tig.c index 3d04317..cffa86d 100644 --- a/tig.c +++ b/tig.c @@ -1488,7 +1488,7 @@ option_color_command(int argc, const char *argv[]) { struct line_info *info; - if (argc != 3 && argc != 4) { + if (argc < 3) { config_msg = "Wrong number of arguments given to color command"; return ERR; } @@ -1515,9 +1515,15 @@ option_color_command(int argc, const char *argv[]) return ERR; } - if (argc == 4 && !set_attribute(&info->attr, argv[3])) { - config_msg = "Unknown attribute"; - return ERR; + info->attr = 0; + while (argc-- > 3) { + int attr; + + if (!set_attribute(&attr, argv[argc])) { + config_msg = "Unknown attribute"; + return ERR; + } + info->attr |= attr; } return OK; -- 2.30.2