Commit e13d420c authored by Richard Russon's avatar Richard Russon
Browse files

merge: merge colours with normal

 * fix quoted colours
 * colour: convert simple colours to normal-backed
 * menu: merge colours with normal
 * question: merge colours with normal
 * sidebar: merge colours with normal
 * index: merge colours with normal
 * pager: merge colours with normal
parents e2899710 4f1c0185
......@@ -133,6 +133,16 @@ bool quoted_colors_parse_color(enum ColorId cid, uint32_t fg, uint32_t bg,
color_debug(LL_DEBUG5, "NT_COLOR_SET: %s\n", buf->data);
mutt_buffer_pool_release(&buf);
if (q_level == 0)
{
// Copy the colour into the SimpleColors
struct AttrColor *ac_quoted = simple_color_get(MT_COLOR_QUOTED);
*ac_quoted = *ac;
ac_quoted->ref_count = 1;
if (ac_quoted->curses_color)
ac_quoted->curses_color->ref_count++;
}
struct EventColor ev_c = { cid, ac };
notify_send(ColorsNotify, NT_COLOR, NT_COLOR_SET, &ev_c);
......
......@@ -189,7 +189,7 @@ static int cbar_repaint(struct MuttWindow *win)
struct ComposeBarData *cbar_data = win->wdata;
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_STATUS);
mutt_window_clrtoeol(win);
mutt_window_move(win, 0, 0);
......
......@@ -346,7 +346,7 @@ static int calc_envelope(struct MuttWindow *win, struct EnvelopeWindowData *wdat
*/
static void draw_floating(struct MuttWindow *win, int col, int row, const char *text)
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_HEADER);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(win, col, row, "%s", text);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
}
......@@ -359,7 +359,7 @@ static void draw_floating(struct MuttWindow *win, int col, int row, const char *
*/
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_HEADER);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(win, 0, row, "%*s", HeaderPadding[field], _(Prompts[field]));
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
}
......@@ -400,23 +400,23 @@ static int draw_crypt_lines(struct MuttWindow *win, struct EnvelopeWindowData *w
int used = 2;
if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN))
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_BOTH);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_BOTH);
mutt_window_addstr(win, _("Sign, Encrypt"));
}
else if (e->security & SEC_ENCRYPT)
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
mutt_window_addstr(win, _("Encrypt"));
}
else if (e->security & SEC_SIGN)
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_SIGN);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_SIGN);
mutt_window_addstr(win, _("Sign"));
}
else
{
/* L10N: This refers to the encryption of the email, e.g. "Security: None" */
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_NONE);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_NONE);
mutt_window_addstr(win, _("None"));
used = 1; // 'Sign as:' won't be needed
}
......@@ -476,12 +476,12 @@ static int draw_crypt_lines(struct MuttWindow *win, struct EnvelopeWindowData *w
draw_header(win, row, HDR_AUTOCRYPT);
if (e->security & SEC_AUTOCRYPT)
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
mutt_window_addstr(win, _("Encrypt"));
}
else
{
mutt_curses_set_color_by_id(MT_COLOR_COMPOSE_SECURITY_NONE);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_COMPOSE_SECURITY_NONE);
mutt_window_addstr(win, _("Off"));
}
......@@ -627,7 +627,7 @@ static int draw_envelope_addr(int field, struct AddressList *al,
if (count > 0)
{
mutt_window_move(win, win->state.cols - more_len, row);
mutt_curses_set_color_by_id(MT_COLOR_BOLD);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_BOLD);
mutt_window_addstr(win, more);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
mutt_debug(LL_DEBUG3, "%d more (len %d)\n", count, more_len);
......@@ -748,7 +748,6 @@ static void draw_envelope(struct MuttWindow *win, struct EnvelopeWindowData *wda
if (c_compose_show_user_headers)
row += draw_envelope_user_hdrs(win, wdata, row);
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
}
......
......@@ -302,7 +302,7 @@ int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags
window_redraw(NULL);
}
mutt_window_clearline(win, 0);
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_addstr(win, field);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
mutt_refresh();
......@@ -502,7 +502,7 @@ int mutt_buffer_enter_fname(const char *prompt, struct Buffer *fname,
struct KeyEvent ch = { OP_NULL, OP_NULL };
struct MuttWindow *old_focus = window_set_focus(win);
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_mvaddstr(win, 0, 0, prompt);
mutt_window_addstr(win, _(" ('?' for list): "));
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -120,7 +120,7 @@ static int msgwin_repaint(struct MuttWindow *win)
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(priv->cid);
mutt_curses_set_normal_backed_color_by_id(priv->cid);
mutt_window_move(win, 0, 0);
mutt_window_addstr(win, priv->text);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -99,7 +99,7 @@ static int sbar_repaint(struct MuttWindow *win)
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_STATUS);
mutt_window_move(win, 0, 0);
mutt_paddstr(win, win->state.cols, priv->display);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -185,7 +185,7 @@ static int helpbar_repaint(struct MuttWindow *win)
if (!wdata)
return 0;
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_STATUS);
mutt_window_move(win, 0, 0);
mutt_paddstr(win, win->state.cols, wdata->help_str);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -898,6 +898,8 @@ void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, siz
int last; ///< Last character of that colour
} *syntax = NULL;
struct AttrColor *ac_base = merged_color_overlay(
simple_color_get(MT_COLOR_NORMAL), simple_color_get(MT_COLOR_STATUS));
do
{
struct RegexColor *cl = NULL;
......@@ -930,8 +932,7 @@ void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, siz
if (!found || (first < syntax[i].first) ||
((first == syntax[i].first) && (last > syntax[i].last)))
{
struct AttrColor *ac_merge =
merged_color_overlay(simple_color_get(MT_COLOR_STATUS), &cl->attr_color);
struct AttrColor *ac_merge = merged_color_overlay(ac_base, &cl->attr_color);
syntax[i].attr_color = ac_merge;
syntax[i].first = first;
......@@ -955,7 +956,7 @@ void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, siz
{
/* Text before the first highlight */
mutt_window_addnstr(win, buf, MIN(len, syntax[0].first));
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_color(ac_base);
if (len <= syntax[0].first)
goto dsl_finish; /* no more room */
......@@ -980,7 +981,7 @@ void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, siz
next = MIN(len, syntax[i + 1].first);
}
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_color(ac_base);
offset = syntax[i].last;
mutt_window_addnstr(win, buf + offset, next - offset);
......@@ -989,7 +990,7 @@ void mutt_draw_statusline(struct MuttWindow *win, int cols, const char *buf, siz
goto dsl_finish; /* no more room */
}
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_color(ac_base);
if (offset < len)
{
/* Text after the last highlight */
......@@ -1380,20 +1381,24 @@ void mutt_set_header_color(struct Mailbox *m, struct Email *e)
struct RegexColor *color = NULL;
struct PatternCache cache = { 0 };
bool match = false;
struct AttrColor *ac_merge = NULL;
STAILQ_FOREACH(color, regex_colors_get_list(MT_COLOR_INDEX), entries)
{
if (mutt_pattern_exec(SLIST_FIRST(color->color_pattern),
MUTT_MATCH_FULL_ADDRESS, m, e, &cache))
{
e->attr_color = &color->attr_color;
match = true;
ac_merge = merged_color_overlay(ac_merge, &color->attr_color);
}
}
if (!match)
e->attr_color = simple_color_get(MT_COLOR_NORMAL);
struct AttrColor *ac_normal = simple_color_get(MT_COLOR_NORMAL);
if (ac_merge)
ac_merge = merged_color_overlay(ac_normal, ac_merge);
else
ac_merge = ac_normal;
e->attr_color = ac_merge;
}
/**
......
......@@ -146,7 +146,7 @@ static int ibar_repaint(struct MuttWindow *win)
struct IndexSharedData *shared = ibar_data->shared;
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_STATUS);
mutt_window_clrtoeol(win);
mutt_window_move(win, 0, 0);
......
......@@ -1639,7 +1639,7 @@ void mutt_what_key(void)
if (!win)
return;
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_mvprintw(win, 0, 0, _("Enter keys (%s to abort): "), km_keyname(AbortKey));
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
enum MuttCursorState cursor = mutt_curses_set_cursor(MUTT_CURSOR_VISIBLE);
......
......@@ -72,31 +72,38 @@ static struct AttrColor *get_color(int index, unsigned char *s)
rcl = regex_colors_get_list(MT_COLOR_INDEX_SUBJECT);
break;
case MT_COLOR_INDEX_TAG:
{
struct AttrColor *ac_merge = NULL;
STAILQ_FOREACH(np, regex_colors_get_list(MT_COLOR_INDEX_TAG), entries)
{
if (mutt_strn_equal((const char *) (s + 1), np->pattern, strlen(np->pattern)))
return &np->attr_color;
{
ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
continue;
}
const char *transform = mutt_hash_find(TagTransforms, np->pattern);
if (transform && mutt_strn_equal((const char *) (s + 1), transform, strlen(transform)))
{
return &np->attr_color;
ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
}
}
return NULL;
return ac_merge;
}
default:
return simple_color_get(type);
}
struct AttrColor *ac_merge = NULL;
STAILQ_FOREACH(np, rcl, entries)
{
if (mutt_pattern_exec(SLIST_FIRST(np->color_pattern),
MUTT_MATCH_FULL_ADDRESS, m_cur, e, NULL))
{
return &np->attr_color;
ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
}
}
return NULL;
return ac_merge;
}
/**
......
......@@ -217,7 +217,9 @@ static void resolve_color(struct MuttWindow *win, struct Line *lines, int line_n
if (!attr_color_match(&color, &last_color))
{
mutt_curses_set_color(&color);
struct AttrColor *ac_merge =
merged_color_overlay(simple_color_get(MT_COLOR_NORMAL), &color);
mutt_curses_set_color(ac_merge);
last_color = color;
}
}
......@@ -389,7 +391,11 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
if (regexec(&color_line->regex, buf, 0, NULL, 0) == 0)
{
lines[line_num].cid = MT_COLOR_HEADER;
lines[line_num].syntax[0].attr_color = &color_line->attr_color;
lines[line_num].syntax[0].attr_color =
merged_color_overlay(lines[line_num].syntax[0].attr_color,
simple_color_get(MT_COLOR_HDRDEFAULT));
lines[line_num].syntax[0].attr_color = merged_color_overlay(
lines[line_num].syntax[0].attr_color, &color_line->attr_color);
if (lines[line_num].cont_header)
{
/* adjust the previous continuation lines to reflect the color of this continuation line */
......@@ -407,7 +413,6 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
}
*force_redraw = true; /* the previous lines have already been drawn on the screen */
}
break;
}
}
}
......@@ -519,6 +524,10 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
{
mutt_mem_realloc(&(lines[line_num].syntax),
(lines[line_num].syntax_arr_size) * sizeof(struct TextSyntax));
// Zero the new entry
const int index = lines[line_num].syntax_arr_size - 1;
struct TextSyntax *ts = &lines[line_num].syntax[index];
memset(ts, 0, sizeof(*ts));
}
}
i = lines[line_num].syntax_arr_size - 1;
......@@ -533,6 +542,15 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
(lines[line_num].syntax)[i].first = pmatch[0].rm_so;
(lines[line_num].syntax)[i].last = pmatch[0].rm_eo;
}
else if ((pmatch[0].rm_so == (lines[line_num].syntax)[i].first) &&
(pmatch[0].rm_eo == (lines[line_num].syntax)[i].last))
{
(lines[line_num].syntax)[i].attr_color = merged_color_overlay(
(lines[line_num].syntax)[i].attr_color, &color_line->attr_color);
(lines[line_num].syntax)[i].first = pmatch[0].rm_so;
(lines[line_num].syntax)[i].last = pmatch[0].rm_eo;
}
found = true;
null_rx = false;
}
......@@ -559,6 +577,7 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
i = 0;
offset = 0;
lines[line_num].syntax_arr_size = 0;
struct AttrColor *ac_attach = simple_color_get(MT_COLOR_ATTACHMENT);
do
{
if (!buf[offset])
......@@ -582,6 +601,10 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
{
mutt_mem_realloc(&(lines[line_num].syntax),
(lines[line_num].syntax_arr_size) * sizeof(struct TextSyntax));
// Zero the new entry
const int index = lines[line_num].syntax_arr_size - 1;
struct TextSyntax *ts = &lines[line_num].syntax[index];
memset(ts, 0, sizeof(*ts));
}
}
i = lines[line_num].syntax_arr_size - 1;
......@@ -591,7 +614,19 @@ static void resolve_types(struct MuttWindow *win, char *buf, char *raw,
((pmatch[0].rm_so == (lines[line_num].syntax)[i].first) &&
(pmatch[0].rm_eo > (lines[line_num].syntax)[i].last)))
{
(lines[line_num].syntax)[i].attr_color = &color_line->attr_color;
if (!(lines[line_num].syntax)[i].attr_color)
(lines[line_num].syntax)[i].attr_color = ac_attach;
(lines[line_num].syntax)[i].attr_color = merged_color_overlay(
(lines[line_num].syntax)[i].attr_color, &color_line->attr_color);
(lines[line_num].syntax)[i].first = pmatch[0].rm_so;
(lines[line_num].syntax)[i].last = pmatch[0].rm_eo;
}
else if ((pmatch[0].rm_so == (lines[line_num].syntax)[i].first) &&
(pmatch[0].rm_eo == (lines[line_num].syntax)[i].last))
{
(lines[line_num].syntax)[i].attr_color = merged_color_overlay(
(lines[line_num].syntax)[i].attr_color, &color_line->attr_color);
(lines[line_num].syntax)[i].first = pmatch[0].rm_so;
(lines[line_num].syntax)[i].last = pmatch[0].rm_eo;
}
......@@ -1192,8 +1227,13 @@ int display_line(FILE *fp, LOFF_T *bytes_read, struct Line **lines,
{
def_color = simple_color_get((*lines)[m].cid);
}
mutt_curses_set_color(def_color);
struct AttrColor *ac_normal = simple_color_get(MT_COLOR_NORMAL);
struct AttrColor *ac_eol = NULL;
if (def_color)
ac_eol = merged_color_overlay(ac_normal, def_color);
else
ac_eol = ac_normal;
mutt_curses_set_color(ac_eol);
}
if (col < win_pager->state.cols)
......
......@@ -223,7 +223,7 @@ static int pager_repaint(struct MuttWindow *win)
// attr_color_list_dump(&priv->ansi_list, "All AnsiColors");
const bool c_tilde = cs_subset_bool(NeoMutt->sub, "tilde");
mutt_curses_set_color_by_id(MT_COLOR_TILDE);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_TILDE);
while (priv->win_height < priv->pview->win_pager->state.rows)
{
mutt_window_clrtoeol(priv->pview->win_pager);
......
......@@ -161,7 +161,7 @@ static int pbar_repaint(struct MuttWindow *win)
// struct IndexSharedData *shared = pbar_data->shared;
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(MT_COLOR_STATUS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_STATUS);
mutt_window_clrtoeol(win);
mutt_window_move(win, 0, 0);
......
......@@ -89,7 +89,7 @@ static void message_bar(struct MuttWindow *win, int percent, const char *fmt, ..
if (l < w)
{
/* The string fits within the colour bar */
mutt_curses_set_color_by_id(MT_COLOR_PROGRESS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROGRESS);
mutt_window_addstr(win, buf2);
w -= l;
while (w-- > 0)
......@@ -105,7 +105,7 @@ static void message_bar(struct MuttWindow *win, int percent, const char *fmt, ..
char ch = buf2[off];
buf2[off] = '\0';
mutt_curses_set_color_by_id(MT_COLOR_PROGRESS);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROGRESS);
mutt_window_addstr(win, buf2);
buf2[off] = ch;
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -59,7 +59,15 @@ int mutt_multi_choice(const char *prompt, const char *letters)
bool redraw = true;
int prompt_lines = 1;
const bool opt_cols = simple_color_is_set(MT_COLOR_OPTIONS);
struct AttrColor *ac_opts = NULL;
if (simple_color_is_set(MT_COLOR_OPTIONS))
{
struct AttrColor *ac_base = simple_color_get(MT_COLOR_NORMAL);
ac_base = merged_color_overlay(ac_base, simple_color_get(MT_COLOR_PROMPT));
ac_opts = simple_color_get(MT_COLOR_OPTIONS);
ac_opts = merged_color_overlay(ac_base, ac_opts);
}
struct MuttWindow *old_focus = window_set_focus(win);
enum MuttCursorState cursor = mutt_curses_set_cursor(MUTT_CURSOR_VISIBLE);
......@@ -81,7 +89,7 @@ int mutt_multi_choice(const char *prompt, const char *letters)
int width = mutt_strwidth(prompt) + 2; // + '?' + space
/* If we're going to colour the options,
* make an assumption about the modified prompt size. */
if (opt_cols)
if (ac_opts)
width -= 2 * mutt_str_len(letters);
prompt_lines = (width + win->state.cols - 1) / win->state.cols;
......@@ -95,20 +103,20 @@ int mutt_multi_choice(const char *prompt, const char *letters)
mutt_window_move(win, 0, 0);
if (opt_cols)
if (ac_opts)
{
char *cur = NULL;
while ((cur = strchr(prompt, '(')))
{
// write the part between prompt and cur using MT_COLOR_PROMPT
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_addnstr(win, prompt, cur - prompt);
if (isalnum(cur[1]) && (cur[2] == ')'))
{
// we have a single letter within parentheses
mutt_curses_set_color_by_id(MT_COLOR_OPTIONS);
mutt_curses_set_color(ac_opts);
mutt_window_addch(win, cur[1]);
prompt = cur + 3;
}
......@@ -121,7 +129,7 @@ int mutt_multi_choice(const char *prompt, const char *letters)
}
}
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_addstr(win, prompt);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......@@ -275,7 +283,7 @@ enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
((size_t) prompt_lines * win->state.cols) - answer_string_wid, NULL);
mutt_window_move(win, 0, 0);
mutt_curses_set_color_by_id(MT_COLOR_PROMPT);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_PROMPT);
mutt_window_addnstr(win, msg, trunc_msg_len);
mutt_window_addstr(win, answer_string);
mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
......
......@@ -250,44 +250,40 @@ static size_t add_indent(char *buf, size_t buflen, const struct SbEntry *sbe)
*/
static struct AttrColor *calc_color(const struct Mailbox *m, bool current, bool highlight)
{
enum ColorId color = MT_COLOR_NORMAL;
struct AttrColor *ac = NULL;
if (m->has_new)
const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
if (simple_color_is_set(MT_COLOR_SIDEBAR_SPOOLFILE) &&
mutt_str_equal(mailbox_path(m), c_spool_file))
{
color = MT_COLOR_SIDEBAR_NEW;
goto done;
ac = merged_color_overlay(ac, simple_color_get(MT_COLOR_SIDEBAR_SPOOLFILE));
}
if (m->msg_unread > 0)
if (simple_color_is_set(MT_COLOR_SIDEBAR_FLAGGED) && (m->msg_flagged > 0))
{
color = MT_COLOR_SIDEBAR_UNREAD;
goto done;
ac = merged_color_overlay(ac, simple_color_get(MT_COLOR_SIDEBAR_FLAGGED));
}
if (m->msg_flagged > 0)
if (simple_color_is_set(MT_COLOR_SIDEBAR_UNREAD) && (m->msg_unread > 0))
{
color = MT_COLOR_SIDEBAR_FLAGGED;
goto done;
ac = merged_color_overlay(ac, simple_color_get(MT_COLOR_SIDEBAR_UNREAD));
}
const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
if (simple_color_is_set(MT_COLOR_SIDEBAR_SPOOLFILE) &&
mutt_str_equal(mailbox_path(m), c_spool_file))
if (simple_color_is_set(MT_COLOR_SIDEBAR_NEW) && m->has_new)
{
color = MT_COLOR_SIDEBAR_SPOOLFILE;
goto done;
ac = merged_color_overlay(ac, simple_color_get(MT_COLOR_SIDEBAR_NEW));
}
if (simple_color_is_set(MT_COLOR_SIDEBAR_ORDINARY))
if (!ac && simple_color_is_set(MT_COLOR_SIDEBAR_ORDINARY))
{
color = MT_COLOR_SIDEBAR_ORDINARY;
goto done;
ac = simple_color_get(MT_COLOR_SIDEBAR_ORDINARY);
}
done:
ac = simple_color_get(color);
ac = merged_color_overlay(simple_color_get(MT_COLOR_NORMAL), ac);
if (current || highlight)
{
int color;
if (current)
{
if (simple_color_is_set(MT_COLOR_SIDEBAR_INDICATOR))
......@@ -300,9 +296,7 @@ done:
color = MT_COLOR_SIDEBAR_HIGHLIGHT;
}
struct AttrColor *ac_overlay = simple_color_get(color);
ac = merged_color_overlay(ac, ac_overlay);
ac = merged_color_overlay(ac, simple_color_get(color));
}
return ac;
......@@ -858,7 +852,7 @@ static int draw_divider(struct SidebarWindowData *wdata, struct MuttWindow *win,
const char *const c_sidebar_divider_char =
cs_subset_string(NeoMutt->sub, "sidebar_divider_char");
mutt_curses_set_color_by_id(MT_COLOR_SIDEBAR_DIVIDER);
mutt_curses_set_normal_backed_color_by_id(MT_COLOR_SIDEBAR_DIVIDER);
const bool c_sidebar_on_right =
cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment