X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=menu.c;h=f8ea243724f5232d96200fa0977a524db52c8644;hp=39e5f0df484b9ddf3e381749ed4d70881723781d;hb=0995d7520848a31481107d897b9a930bff222ce7;hpb=b25e26b05ff3172041861e032cb839871367a480 diff --git a/menu.c b/menu.c index 39e5f0d..f8ea243 100644 --- a/menu.c +++ b/menu.c @@ -29,6 +29,8 @@ #include #include +#define SW (option(OPTMBOXPANE)?SidebarWidth:0) + extern int Charset_is_utf8; /* FIXME: bad modularisation */ extern size_t UngetCount; @@ -217,18 +219,20 @@ void menu_redraw_index (MUTTMENU * menu) if (i == menu->current) { attrset (menu->color (i)); ADDCOLOR (MT_COLOR_INDICATOR); + BKGDSET (MT_COLOR_INDICATOR); addstr ("->"); attrset (menu->color (i)); addch (' '); } else { attrset (menu->color (i)); - move (i - menu->top + menu->offset, SidebarWidth); + move (i - menu->top + menu->offset, SW); addstr (" "); } print_enriched_string (menu->color (i), (unsigned char *) buf, 1); SETCOLOR (MT_COLOR_NORMAL); + BKGDSET (MT_COLOR_NORMAL); } else { attrset (menu->color (i)); @@ -239,6 +243,8 @@ void menu_redraw_index (MUTTMENU * menu) } CLEARLINE_WIN (i - menu->top + menu->offset); + + move (i - menu->top + menu->offset, SW); print_enriched_string (menu->color (i), (unsigned char *) buf, i != menu->current); SETCOLOR (MT_COLOR_NORMAL); @@ -260,7 +266,7 @@ void menu_redraw_motion (MUTTMENU * menu) return; } - move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth); + move (menu->oldcurrent + menu->offset - menu->top, SW); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); @@ -273,14 +279,14 @@ void menu_redraw_motion (MUTTMENU * menu) clrtoeol (); menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); menu_pad_string (buf, sizeof (buf)); - move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3); + move (menu->oldcurrent + menu->offset - menu->top, SW + 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, SidebarWidth); + move (menu->current + menu->offset - menu->top, SW); attrset (menu->color (menu->current)); ADDCOLOR (MT_COLOR_INDICATOR); addstr ("->"); @@ -302,6 +308,7 @@ void menu_redraw_motion (MUTTMENU * menu) ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); CLEARLINE_WIN (menu->current - menu->top + menu->offset); + move (menu->current + menu->offset - menu->top, SW); print_enriched_string (menu->color (menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); @@ -314,7 +321,7 @@ void menu_redraw_current (MUTTMENU * menu) { char buf[STRING]; - move (menu->current + menu->offset - menu->top, SidebarWidth); + move (menu->current + menu->offset - menu->top, SW); menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); @@ -373,23 +380,18 @@ void menu_check_recenter (MUTTMENU * menu) menu->top = 0; set_option (OPTNEEDREDRAW); } - } - else if (menu->current >= menu->top + menu->pagelen - c) { /* indicator below bottom threshold */ - if (option (OPTMENUSCROLL) || (menu->pagelen <= 0)) - menu->top = menu->current - menu->pagelen + c + 1; - else - menu->top += - (menu->pagelen - - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; - } - else if (menu->current < menu->top + c) { /* indicator above top threshold */ - if (option (OPTMENUSCROLL) || (menu->pagelen <= 0)) - menu->top = menu->current - c; - else - menu->top -= - (menu->pagelen - - c) * ((menu->top + menu->pagelen - 1 - - menu->current) / (menu->pagelen - c)) - c; + } else { + if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext)) { + if (menu->current < menu->top + c) + menu->top = menu->current - c; + else if (menu->current >= menu->top + menu->pagelen - c) + menu->top = menu->current - menu->pagelen + c + 1; + } else { + if (menu->current < menu->top + c) + menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c; + else if ((menu->current >= menu->top + menu->pagelen - c)) + menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; + } } if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */ @@ -813,9 +815,9 @@ int mutt_menuLoop (MUTTMENU * menu) menu->oldcurrent = menu->current; if (option (OPTARROWCURSOR)) - move (menu->current - menu->top + menu->offset, 2); + move (menu->current - menu->top + menu->offset, SW + 2); else if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, 0); + move (menu->current - menu->top + menu->offset, SW); else move (menu->current - menu->top + menu->offset, COLS - 1); @@ -996,6 +998,10 @@ int mutt_menuLoop (MUTTMENU * menu) mutt_what_key (); break; + case OP_REBUILD_CACHE: + mx_rebuild_cache (); + break; + case OP_REDRAW: clearok (stdscr, TRUE); menu->redraw = REDRAW_FULL;