SETCOLOR (MT_COLOR_STATUS);
mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
- BKGDSET (MT_COLOR_STATUS);
clrtoeol ();
- BKGDSET (MT_COLOR_NORMAL);
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
}
static int edit_address_list (int line, ADDRESS **addr)
{
mutt_str_replace (&msg->env->subject, buf);
move (HDR_SUBJECT, HDR_XOFFSET);
- clrtoeol ();
if (msg->env->subject)
mutt_paddstr (W, msg->env->subject);
+ else
+ clrtoeol();
}
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
if (menu->redraw & REDRAW_STATUS)
{
compose_status_line (buf, sizeof (buf), 0, menu, NONULL(ComposeFormat));
- CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
+ move(option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
SETCOLOR (MT_COLOR_STATUS);
- BKGDSET (MT_COLOR_STATUS);
mutt_paddstr (COLS, buf);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
}
}
}
s++, n--;
}
- if (do_color) attrset(attr);
+ if (do_color) ATTRSET(attr);
}
else if ((k = mbrtowc (&wc, (char *)s, n, &mbstate)) > 0)
{
void menu_redraw_full (MUTTMENU *menu)
{
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
/* clear() doesn't optimize screen redraws */
move (0, 0);
clrtobot ();
SETCOLOR (MT_COLOR_STATUS);
move (option (OPTSTATUSONTOP) ? LINES-2 : 0, 0);
mutt_paddstr (COLS, menu->help);
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
menu->offset = 1;
menu->pagelen = LINES - 3;
}
SETCOLOR (MT_COLOR_STATUS);
move (option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
mutt_paddstr (COLS, buf);
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
}
{
char buf[LONG_STRING];
int i;
+ int do_color;
+ int attr;
for (i = menu->top; i < menu->top + menu->pagelen; i++)
{
if (i < menu->max)
{
+ attr = menu->color(i);
+
menu_make_entry (buf, sizeof (buf), menu, i);
menu_pad_string (buf, sizeof (buf));
- if (option (OPTARROWCURSOR))
- {
- attrset (menu->color (i));
- CLEARLINE (i - menu->top + menu->offset);
-
- if (i == menu->current)
- {
- attrset (menu->color (i));
- ADDCOLOR (MT_COLOR_INDICATOR);
- addstr ("->");
- attrset (menu->color (i));
- addch (' ');
- }
- else
- {
- attrset (menu->color (i));
- addstr (" ");
- }
+ ATTRSET(attr);
+ move(i - menu->top + menu->offset, 0);
+ do_color = 1;
- print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
- SETCOLOR (MT_COLOR_NORMAL);
- }
- else
+ if (i == menu->current)
{
- attrset (menu->color (i));
-
- if (i == menu->current)
- {
- ADDCOLOR (MT_COLOR_INDICATOR);
- BKGDSET (MT_COLOR_INDICATOR);
- }
-
- CLEARLINE (i - menu->top + menu->offset);
- print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
+ SETCOLOR(MT_COLOR_INDICATOR);
+ if (option(OPTARROWCURSOR))
+ {
+ addstr ("->");
+ ATTRSET(attr);
+ addch (' ');
+ }
+ else
+ do_color = 0;
}
+ else if (option(OPTARROWCURSOR))
+ addstr(" ");
+
+ print_enriched_string (attr, (unsigned char *) buf, do_color);
}
else
- CLEARLINE (i - menu->top + menu->offset);
+ {
+ NORMAL_COLOR;
+ CLEARLINE(i - menu->top + menu->offset);
+ }
}
+ NORMAL_COLOR;
menu->redraw = 0;
}
}
move (menu->oldcurrent + menu->offset - menu->top, 0);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
+ ATTRSET(menu->color (menu->oldcurrent));
if (option (OPTARROWCURSOR))
{
/* clear the pointer */
- attrset (menu->color (menu->oldcurrent));
addstr (" ");
if (menu->redraw & REDRAW_MOTION_RESYNCH)
{
- clrtoeol ();
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
menu_pad_string (buf, sizeof (buf));
move (menu->oldcurrent + menu->offset - menu->top, 3);
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
- SETCOLOR (MT_COLOR_NORMAL);
}
/* now draw it in the new location */
- move (menu->current + menu->offset - menu->top, 0);
- attrset (menu->color (menu->current));
- ADDCOLOR (MT_COLOR_INDICATOR);
- addstr ("->");
- SETCOLOR (MT_COLOR_NORMAL);
+ SETCOLOR(MT_COLOR_INDICATOR);
+ mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
}
else
{
/* erase the current indicator */
- attrset (menu->color (menu->oldcurrent));
- clrtoeol ();
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
menu_pad_string (buf, sizeof (buf));
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
/* now draw the new one to reflect the change */
menu_make_entry (buf, sizeof (buf), menu, menu->current);
menu_pad_string (buf, sizeof (buf));
- attrset (menu->color (menu->current));
- ADDCOLOR (MT_COLOR_INDICATOR);
- BKGDSET (MT_COLOR_INDICATOR);
- CLEARLINE (menu->current - menu->top + menu->offset);
+ SETCOLOR(MT_COLOR_INDICATOR);
+ move(menu->current - menu->top + menu->offset, 0);
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
}
menu->redraw &= REDRAW_STATUS;
+ NORMAL_COLOR;
}
void menu_redraw_current (MUTTMENU *menu)
{
char buf[LONG_STRING];
+ int attr = menu->color (menu->current);
move (menu->current + menu->offset - menu->top, 0);
menu_make_entry (buf, sizeof (buf), menu, menu->current);
menu_pad_string (buf, sizeof (buf));
+ SETCOLOR(MT_COLOR_INDICATOR);
if (option (OPTARROWCURSOR))
{
- int attr = menu->color (menu->current);
- attrset (attr);
- clrtoeol ();
- attrset (menu->color (menu->current));
- ADDCOLOR (MT_COLOR_INDICATOR);
addstr ("->");
- attrset (attr);
+ ATTRSET(attr);
addch (' ');
menu_pad_string (buf, sizeof (buf));
- print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 1);
- SETCOLOR (MT_COLOR_NORMAL);
+ print_enriched_string (attr, (unsigned char *) buf, 1);
}
else
- {
- attrset (menu->color (menu->current));
- ADDCOLOR (MT_COLOR_INDICATOR);
- BKGDSET (MT_COLOR_INDICATOR);
- clrtoeol ();
- print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
- }
+ print_enriched_string (attr, (unsigned char *) buf, 0);
menu->redraw &= REDRAW_STATUS;
+ NORMAL_COLOR;
}
static void menu_redraw_prompt (MUTTMENU *menu)
if (*Errorbuf)
mutt_clear_error ();
- SETCOLOR (MT_COLOR_NORMAL);
mvaddstr (LINES - 1, 0, menu->prompt);
clrtoeol ();
}
if (color != last_color)
{
- attrset (color);
+ ATTRSET (color);
last_color = color;
}
}
#ifndef USE_SLANG_CURSES
if (col == 0)
{
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
addch (' ');
}
#endif
else
def_color = ColorDefs[ (*lineInfo)[m].type ];
- attrset (def_color);
-#ifdef HAVE_BKGDSET
- bkgdset (def_color | ' ');
-#endif
+ ATTRSET(def_color);
}
/* ncurses always wraps lines when you get to the right side of the
* filled to the right margin.
*/
if (flags & M_SHOWCOLOR)
- {
- SETCOLOR(MT_COLOR_NORMAL);
- BKGDSET(MT_COLOR_NORMAL);
- }
+ NORMAL_COLOR;
/* build a return code */
if (!(flags & M_SHOW))
if (redraw & REDRAW_FULL)
{
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
/* clear() doesn't optimize screen redraws */
move (0, 0);
clrtobot ();
SETCOLOR (MT_COLOR_STATUS);
move (helpoffset, 0);
mutt_paddstr (COLS, helpstr);
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
}
#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM)
index->current = extra->hdr->virtual;
}
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0);
index->pagelen = indexlen - 1;
} while (force_redraw);
SETCOLOR (MT_COLOR_TILDE);
- BKGDSET (MT_COLOR_TILDE);
while (lines < bodylen)
{
clrtoeol ();
addch ('\n');
lines++;
}
+ NORMAL_COLOR;
+
/* We are going to update the pager status bar, so it isn't
* necessary to reset to normal color now. */
/* print out the pager status bar */
SETCOLOR (MT_COLOR_STATUS);
- BKGDSET (MT_COLOR_STATUS);
- CLEARLINE (statusoffset);
if (IsHeader (extra) || IsMsgAttach (extra))
{
snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
mutt_paddstr (COLS, bn);
}
- BKGDSET (MT_COLOR_NORMAL);
- SETCOLOR (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
}
if ((redraw & REDRAW_INDEX) && index)
move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
SETCOLOR (MT_COLOR_STATUS);
- BKGDSET (MT_COLOR_STATUS);
mutt_paddstr (COLS, buffer);
- SETCOLOR (MT_COLOR_NORMAL);
- BKGDSET (MT_COLOR_NORMAL);
+ NORMAL_COLOR;
}
redraw = 0;