memset(c->defs, A_NORMAL, MT_COLOR_MAX * sizeof(int));
// Set some defaults
- c->defs[MT_COLOR_STATUS] = A_REVERSE;
c->defs[MT_COLOR_INDICATOR] = A_REVERSE;
- c->defs[MT_COLOR_SEARCH] = A_REVERSE;
c->defs[MT_COLOR_MARKERS] = A_REVERSE;
+ c->defs[MT_COLOR_SEARCH] = A_REVERSE;
#ifdef USE_SIDEBAR
c->defs[MT_COLOR_SIDEBAR_HIGHLIGHT] = A_UNDERLINE;
#endif
+ c->defs[MT_COLOR_STATUS] = A_REVERSE;
}
/**
if (mutt_str_strcasecmp("bold", buf->data) == 0)
*attr |= A_BOLD;
- else if (mutt_str_strcasecmp("underline", buf->data) == 0)
- *attr |= A_UNDERLINE;
else if (mutt_str_strcasecmp("none", buf->data) == 0)
- *attr = A_NORMAL;
+ *attr = A_NORMAL; // Use '=' to clear other bits
+ else if (mutt_str_strcasecmp("normal", buf->data) == 0)
+ *attr = A_NORMAL; // Use '=' to clear other bits
else if (mutt_str_strcasecmp("reverse", buf->data) == 0)
*attr |= A_REVERSE;
else if (mutt_str_strcasecmp("standout", buf->data) == 0)
*attr |= A_STANDOUT;
- else if (mutt_str_strcasecmp("normal", buf->data) == 0)
- *attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
+ else if (mutt_str_strcasecmp("underline", buf->data) == 0)
+ *attr |= A_UNDERLINE;
else
{
rc = parse_color_name(buf->data, fg, attr, true, err);
if (mutt_str_strcasecmp("bold", buf->data) == 0)
*attr |= A_BOLD;
- else if (mutt_str_strcasecmp("underline", buf->data) == 0)
- *attr |= A_UNDERLINE;
else if (mutt_str_strcasecmp("none", buf->data) == 0)
- *attr = A_NORMAL;
+ *attr = A_NORMAL; // Use '=' to clear other bits
+ else if (mutt_str_strcasecmp("normal", buf->data) == 0)
+ *attr = A_NORMAL; // Use '=' to clear other bits
else if (mutt_str_strcasecmp("reverse", buf->data) == 0)
*attr |= A_REVERSE;
else if (mutt_str_strcasecmp("standout", buf->data) == 0)
*attr |= A_STANDOUT;
- else if (mutt_str_strcasecmp("normal", buf->data) == 0)
- *attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
+ else if (mutt_str_strcasecmp("underline", buf->data) == 0)
+ *attr |= A_UNDERLINE;
else
{
mutt_buffer_printf(err, _("%s: no such attribute"), buf->data);
/* extract a regular expression if needed */
- if ((object == MT_COLOR_BODY) || (object == MT_COLOR_HEADER) ||
- (object == MT_COLOR_ATTACH_HEADERS) || (object == MT_COLOR_INDEX) ||
+ if ((object == MT_COLOR_ATTACH_HEADERS) || (object == MT_COLOR_BODY) ||
+ (object == MT_COLOR_HEADER) || (object == MT_COLOR_INDEX) ||
(object == MT_COLOR_INDEX_AUTHOR) || (object == MT_COLOR_INDEX_FLAGS) ||
- (object == MT_COLOR_INDEX_TAG) || (object == MT_COLOR_INDEX_SUBJECT))
+ (object == MT_COLOR_INDEX_SUBJECT) || (object == MT_COLOR_INDEX_TAG))
{
if (!MoreArgs(s))
{
#endif /* HAVE_USE_DEFAULT_COLORS */
#endif
- if (object == MT_COLOR_HEADER)
- rc = add_pattern(c, &c->hdr_list, buf->data, false, fg, bg, attr, err, false, match);
+ if (object == MT_COLOR_ATTACH_HEADERS)
+ rc = add_pattern(c, &c->attach_list, buf->data, true, fg, bg, attr, err, false, match);
else if (object == MT_COLOR_BODY)
rc = add_pattern(c, &c->body_list, buf->data, true, fg, bg, attr, err, false, match);
- else if (object == MT_COLOR_ATTACH_HEADERS)
- rc = add_pattern(c, &c->attach_list, buf->data, true, fg, bg, attr, err, false, match);
- else if ((object == MT_COLOR_STATUS) && MoreArgs(s))
- {
- /* 'color status fg bg' can have up to 2 arguments:
- * 0 arguments: sets the default status color (handled below by else part)
- * 1 argument : colorize pattern on match
- * 2 arguments: colorize nth submatch of pattern */
- mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
-
- if (MoreArgs(s))
- {
- struct Buffer tmp = mutt_buffer_make(0);
- mutt_extract_token(&tmp, s, MUTT_TOKEN_NO_FLAGS);
- if (mutt_str_atoui(tmp.data, &match) < 0)
- {
- mutt_buffer_printf(err, _("%s: invalid number: %s"),
- color ? "color" : "mono", tmp.data);
- mutt_buffer_dealloc(&tmp);
- return MUTT_CMD_WARNING;
- }
- mutt_buffer_dealloc(&tmp);
- }
-
- if (MoreArgs(s))
- {
- mutt_buffer_printf(err, _("%s: too many arguments"), color ? "color" : "mono");
- return MUTT_CMD_WARNING;
- }
-
- rc = add_pattern(c, &c->status_list, buf->data, true, fg, bg, attr, err, false, match);
- }
+ else if (object == MT_COLOR_HEADER)
+ rc = add_pattern(c, &c->hdr_list, buf->data, false, fg, bg, attr, err, false, match);
else if (object == MT_COLOR_INDEX)
{
rc = add_pattern(c, &c->index_list, buf->data, true, fg, bg, attr, err, true, match);
}
else if (object == MT_COLOR_INDEX_AUTHOR)
{
- rc = add_pattern(c, &c->index_author_list, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(c, &c->index_author_list, buf->data, true, fg, bg, attr,
+ err, true, match);
}
else if (object == MT_COLOR_INDEX_FLAGS)
{
}
else if (object == MT_COLOR_INDEX_SUBJECT)
{
- rc = add_pattern(c, &c->index_subject_list, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(c, &c->index_subject_list, buf->data, true, fg, bg, attr,
+ err, true, match);
}
else if (object == MT_COLOR_INDEX_TAG)
{
{
if (q_level >= COLOR_QUOTES_MAX)
{
- mutt_buffer_printf(err, _("Maximum quoting level is %d"), COLOR_QUOTES_MAX-1);
+ mutt_buffer_printf(err, _("Maximum quoting level is %d"), COLOR_QUOTES_MAX - 1);
return MUTT_CMD_WARNING;
}
}
rc = MUTT_CMD_SUCCESS;
}
- else
+ else if ((object == MT_COLOR_STATUS) && MoreArgs(s))
+ {
+ /* 'color status fg bg' can have up to 2 arguments:
+ * 0 arguments: sets the default status color (handled below by else part)
+ * 1 argument : colorize pattern on match
+ * 2 arguments: colorize nth submatch of pattern */
+ mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
+
+ if (MoreArgs(s))
+ {
+ struct Buffer tmp = mutt_buffer_make(0);
+ mutt_extract_token(&tmp, s, MUTT_TOKEN_NO_FLAGS);
+ if (mutt_str_atoui(tmp.data, &match) < 0)
+ {
+ mutt_buffer_printf(err, _("%s: invalid number: %s"),
+ color ? "color" : "mono", tmp.data);
+ mutt_buffer_dealloc(&tmp);
+ return MUTT_CMD_WARNING;
+ }
+ mutt_buffer_dealloc(&tmp);
+ }
+
+ if (MoreArgs(s))
+ {
+ mutt_buffer_printf(err, _("%s: too many arguments"), color ? "color" : "mono");
+ return MUTT_CMD_WARNING;
+ }
+
+ rc = add_pattern(c, &c->status_list, buf->data, true, fg, bg, attr, err, false, match);
+ }
+ else // Remaining simple colours
{
c->defs[object] = fgbgattr_to_color(c, fg, bg, attr);
rc = MUTT_CMD_SUCCESS;