#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mbyte.h"
+#include "sidebar.h"
#ifdef USE_IMAP
#include "imap.h"
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;
- short f1, f2, b1, b2;
- memset (&mbstate, 0, sizeof (mbstate));
while (*s)
{
if (*s < M_TREE_MAX)
{
if (do_color)
- {
- pair_content(PAIR_NUMBER(ColorDefs[MT_COLOR_TREE]), &f1, &b1);
- pair_content(PAIR_NUMBER(attr), &f2, &b2);
- if (b1 == b2)
- SETCOLOR (MT_COLOR_TREE);
- }
+ SETCOLOR (MT_COLOR_TREE);
while (*s && *s < M_TREE_MAX)
{
switch (*s)
}
if (do_color) attrset(attr);
}
- else if ((k = mbrtowc (&wc, (char *)s, n, &mbstate)) > 0)
+ else if (*s > 0)
{
- addnstr ((char *)s, k);
- s += k, n-= k;
+ addnstr ((char *)s, 1);
+ s += 1, n-= 1;
}
else
break;
void menu_pad_string (char *s, size_t n)
{
int shift = option (OPTARROWCURSOR) ? 3 : 0;
- int cols = COLS - shift;
+ int cols = COLS - shift - SidebarWidth;
mutt_format_string (s, n, cols, cols, 0, ' ', s, strlen (s), 1);
s[n - 1] = 0;
char buf[STRING];
int i;
+ draw_sidebar(1);
for (i = menu->top; i < menu->top + menu->pagelen; i++)
{
if (i < menu->max)
if (option (OPTARROWCURSOR))
{
attrset (menu->color (i));
- CLEARLINE (i - menu->top + menu->offset);
+ CLEARLINE_WIN (i - menu->top + menu->offset);
if (i == menu->current)
{
addch (' ');
}
else
- move (i - menu->top + menu->offset, 3);
+ move (i - menu->top + menu->offset, SidebarWidth + 3);
print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
SETCOLOR (MT_COLOR_NORMAL);
BKGDSET (MT_COLOR_INDICATOR);
}
- CLEARLINE (i - menu->top + menu->offset);
+ CLEARLINE_WIN (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);
}
}
else
- CLEARLINE (i - menu->top + menu->offset);
+ CLEARLINE_WIN (i - menu->top + menu->offset);
}
menu->redraw = 0;
}
return;
}
- move (menu->oldcurrent + menu->offset - menu->top, 0);
+ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
SETCOLOR (MT_COLOR_NORMAL);
BKGDSET (MT_COLOR_NORMAL);
clrtoeol ();
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
menu_pad_string (buf, sizeof (buf));
- move (menu->oldcurrent + menu->offset - menu->top, 3);
+ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 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);
+ move (menu->current + menu->offset - menu->top, SidebarWidth);
attrset (menu->color (menu->current));
ADDCOLOR (MT_COLOR_INDICATOR);
addstr ("->");
attrset (menu->color (menu->current));
ADDCOLOR (MT_COLOR_INDICATOR);
BKGDSET (MT_COLOR_INDICATOR);
- CLEARLINE (menu->current - menu->top + menu->offset);
+ CLEARLINE_WIN (menu->current - menu->top + menu->offset);
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
SETCOLOR (MT_COLOR_NORMAL);
BKGDSET (MT_COLOR_NORMAL);
{
char buf[STRING];
- move (menu->current + menu->offset - menu->top, 0);
+ move (menu->current + menu->offset - menu->top, SidebarWidth);
menu_make_entry (buf, sizeof (buf), menu, menu->current);
menu_pad_string (buf, sizeof (buf));
for (i=0; i < (*p)->max; i++)
FREE (&(*p)->dialog[i]);
- FREE ((*p)->dialog);
+ FREE (& (*p)->dialog);
}
FREE (p);