X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=menu.c;h=8afdc10efee1595f99b04f05e597715da3e8eda5;hp=4f67b8463a79eb46e5e0c65262dde4e6e3d34918;hb=3d8ec820b093cfe10a3738cfc8d8fedd813a73d7;hpb=c8c4a96d55967447a5ebe380270adfb97f83cac5 diff --git a/menu.c b/menu.c index 4f67b84..8afdc10 100644 --- a/menu.c +++ b/menu.c @@ -373,23 +373,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; - 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 */