summaryrefslogtreecommitdiffstats
path: root/curs_main.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-06-04 11:32:03 -0700
committerKevin McCarthy <kevin@8t8.us>2016-06-04 11:32:03 -0700
commit086a5b8092544d68933d851af83c14c8dcbd834d (patch)
treeb364c239b68decdf274b0c4560f084ba1989aeca /curs_main.c
parent389c74bb20b20ab31c14460962fbbb6bba82127d (diff)
Sidebar clean up: building and drawing logic.
Fix the autoconf/makefile.am changes to be consistent. Create a global SidebarNeedsRedraw to indicate a redraw is needed, instead of putting sb_draw() everywhere in the code. Create a menu_redraw_sidebar() function and use the REDRAW_SIDEBAR flag instead of piggy-backing it inside the index loop. Fix curs_main.c and pager.c to be a bit cleaner by using the global and REDRAW_SIDEBAR. Start to clean up some of the buffy code, but this needs to refactored and fixed.
Diffstat (limited to 'curs_main.c')
-rw-r--r--curs_main.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/curs_main.c b/curs_main.c
index e138906c..f18debbd 100644
--- a/curs_main.c
+++ b/curs_main.c
@@ -609,31 +609,24 @@ int mutt_index_menu (void)
do_buffy_notify = 1;
}
-#ifdef USE_SIDEBAR
- if (option (OPTSIDEBAR))
- menu->redraw |= REDRAW_SIDEBAR;
-#endif
-
if (op != -1)
mutt_curs_set (0);
if (menu->redraw & REDRAW_FULL)
{
menu_redraw_full (menu);
-#ifdef USE_SIDEBAR
- sb_draw();
-#endif
mutt_show_error ();
}
-#ifdef USE_SIDEBAR
- else if (menu->redraw & REDRAW_SIDEBAR) {
- sb_draw();
- menu->redraw &= ~REDRAW_SIDEBAR;
- }
-#endif
if (menu->menu == MENU_MAIN)
{
+#ifdef USE_SIDEBAR
+ if (menu->redraw & REDRAW_SIDEBAR || SidebarNeedsRedraw)
+ {
+ sb_set_buffystats (Context);
+ menu_redraw_sidebar (menu);
+ }
+#endif
if (Context && Context->hdrs && !(menu->current >= Context->vcount))
{
menu_check_recenter (menu);
@@ -654,9 +647,6 @@ int mutt_index_menu (void)
menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
mutt_window_move (MuttStatusWindow, 0, 0);
SETCOLOR (MT_COLOR_STATUS);
-#ifdef USE_SIDEBAR
- sb_set_buffystats (Context);
-#endif
mutt_paddstr (MuttStatusWindow->cols, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
@@ -1116,9 +1106,6 @@ int mutt_index_menu (void)
break;
CHECK_MSGCOUNT;
-#ifdef USE_SIDEBAR
- CHECK_VISIBLE;
-#endif
CHECK_READONLY;
{
int oldvcount = Context->vcount;
@@ -1208,28 +1195,29 @@ int mutt_index_menu (void)
break;
}
}
+#ifdef USE_SIDEBAR
+ else if (op == OP_SIDEBAR_OPEN)
+ {
+ const char *path = sb_get_highlight();
+ if (!path || !*path)
+ break;
+ strncpy (buf, path, sizeof (buf));
+ }
+#endif
else
{
mutt_buffy (buf, sizeof (buf));
-#ifdef USE_SIDEBAR
- if (op == OP_SIDEBAR_OPEN) {
- const char *path = sb_get_highlight();
- if (!path)
- break;
- strncpy (buf, path, sizeof (buf));
- } else
-#endif
- if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
- {
- if (menu->menu == MENU_PAGER)
- {
- op = OP_DISPLAY_MESSAGE;
- continue;
- }
- else
- break;
- }
+ if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
+ {
+ if (menu->menu == MENU_PAGER)
+ {
+ op = OP_DISPLAY_MESSAGE;
+ continue;
+ }
+ else
+ break;
+ }
if (!buf[0])
{
mutt_window_clearline (MuttMessageWindow, 0);