/*
* 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 (int attr, unsigned char *s, int do_color)
{
wchar_t wc;
size_t k;
size_t n = mutt_strlen ((char *)s);
mbstate_t mbstate;
memset (&mbstate, 0, sizeof (mbstate));
while (*s)
{
if (*s < MUTT_TREE_MAX)
{
if (do_color)
SETCOLOR (MT_COLOR_TREE);
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 */
else
addch (ACS_ULCORNER);
#endif
break;
case MUTT_TREE_LTEE:
if (option (OPTASCIICHARS))
addch ('|');
#ifdef WACS_LTEE
else
add_wch(WACS_LTEE);
#else
else if (Charset_is_utf8)
addstr ("\342\224\234"); /* WACS_LTEE */
else
addch (ACS_LTEE);
#endif
break;
case MUTT_TREE_HLINE:
if (option (OPTASCIICHARS))
addch ('-');
#ifdef WACS_HLINE
else
add_wch(WACS_HLINE);
#else
else if (Charset_is_utf8)
addstr ("\342\224\200"); /* WACS_HLINE */
else
addch (ACS_HLINE);
#endif
break;
case MUTT_TREE_VLINE:
if (option (OPTASCIICHARS))
addch ('|');
#ifdef WACS_VLINE
else
add_wch(WACS_VLINE);
#else
else if (Charset_is_utf8)
addstr ("\342\224\202"); /*