/*
* Copyright (C) 1996-2000,2002,2012 Michael R. Elkins <me@mutt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "mutt.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mbyte.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
#endif
char* SearchBuffers[MENU_MAX];
/* These are used to track the active menus, for redraw operations. */
static size_t MenuStackCount = 0;
static size_t MenuStackLen = 0;
static MUTTMENU **MenuStack = NULL;
static void print_enriched_string (COLOR_ATTR base_color, unsigned char *s,
int use_indicator)
{
wchar_t wc;
size_t k;
size_t n = mutt_strlen ((char *)s);
mbstate_t mbstate;
COLOR_ATTR tree_color;
if (option (OPTCURSOROVERLAY))
{
tree_color = mutt_merge_colors (base_color, ColorDefs[MT_COLOR_TREE]);
if (use_indicator)
{
tree_color = mutt_merge_colors (tree_color, ColorDefs[MT_COLOR_INDICATOR]);
base_color = mutt_merge_colors (base_color, ColorDefs[MT_COLOR_INDICATOR]);
}
}
else
{
tree_color = ColorDefs[MT_COLOR_TREE];
if (use_indicator)
{
tree_color = ColorDefs[MT_COLOR_INDICATOR];
base_color = ColorDefs[MT_COLOR_INDICATOR];
}
}
ATTRSET (base_color);
memset (&mbstate, 0, sizeof (mbstate));
while (*s)
{
if (*s < MUTT_TREE_MAX)
{
ATTRSET (tree_color);
while (*s && *s < MUTT_TREE_MAX)
{
switch (*s)
{
case MUTT_TREE_LLCORNER:
if (option (OPTASCIICHARS))
addch ('`');
#ifdef WACS_LLCORNER
else
add_wch(WACS_LLCORNER);
#else
else if (Charset_is_utf8)
addstr ("\342\224\224"); /* WACS_LLCORNER */
else
addch (ACS_LLCORNER);
#endif
break;
case MUTT_TREE_ULCORNER:
if (option (OPTASCIICHARS))
addch (',');
#ifdef WACS_ULCORNER
else
add_wch(WACS_ULCORNER);
#else
else if (Charset_is_utf8)
addstr ("\342\224\214"); /* WACS_ULCORNER */