X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=menu.c;h=7a8c834b8ac10ddb3f058a5a05247ea1fb0b73c0;hp=15eccce1f5006a4d795bf71981cdf7635dbf5898;hb=09e1bf15b3c55ca9c44c09d2e91dd251af2da706;hpb=9bd4cf1b49105dcc131bf722abcbb24fed67d4dc diff --git a/menu.c b/menu.c index 15eccce..7a8c834 100644 --- a/menu.c +++ b/menu.c @@ -380,7 +380,7 @@ void menu_check_recenter (MUTTMENU *menu) int c = MIN (MenuContext, menu->pagelen / 2); int old_top = menu->top; - if (menu->max <= menu->pagelen) /* less entries than lines */ + if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) /* less entries than lines */ { if (menu->top != 0) { menu->top = 0; @@ -402,8 +402,8 @@ void menu_check_recenter (MUTTMENU *menu) menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c; } - /* make entries stick to bottom */ - menu->top = MIN (menu->top, menu->max - menu->pagelen); + if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */ + menu->top = MIN (menu->top, menu->max - menu->pagelen); menu->top = MAX (menu->top, 0); if (menu->top != old_top) @@ -439,10 +439,13 @@ void menu_next_line (MUTTMENU *menu) { if (menu->max) { - if (menu->top + 1 < menu->max) + int c = MIN (MenuContext, menu->pagelen / 2); + + if (menu->top + 1 < menu->max - c + && (option(OPTMENUMOVEOFF) || (menu->max > menu->pagelen && menu->top < menu->max - menu->pagelen))) { menu->top++; - if (menu->current < menu->top) + if (menu->current < menu->top + c && menu->current < menu->max - 1) menu->current++; menu->redraw = REDRAW_INDEX; } @@ -457,8 +460,10 @@ void menu_prev_line (MUTTMENU *menu) { if (menu->top > 0) { + int c = MIN (MenuContext, menu->pagelen / 2); + menu->top--; - if (menu->current >= menu->top + menu->pagelen) + if (menu->current >= menu->top + menu->pagelen - c && menu->current > 1) menu->current--; menu->redraw = REDRAW_INDEX; }