Hi, I've updated the menu_context patch to reintroduce the menu_move_off variable that hasn't made it into 1.5.8. The patch fixes menu_prev_line and menu_next_line which didn't work with menu_context > 0 and also makes <current-middle> work even if there are less messages than screen lines (thanks to René Clerc and Vincent Lefevre for spotting these issues). Christoph -- cb@xxxxxxxx | http://www.df7cb.de/
patch-1.5.8.cb.menu_context.8 ----------------------------- This patch introduces two new options, menu_context and menu_move_off. It is an improved version of patch-1.5.5.1.mgs.index-context.5 my Mike Schiraldi (where menu_context was called index_context). 6.3.101. menu_context (already included in mutt CVS/1.5.7) Type: number Default: 0 This variable controls the number of lines of context that are given when scrolling through menus. (Similar to ````$pager_context''''.) 6.3.102. menu_move_off (NEW) Type: boolean Default: yes When unset, the bottom entry of menus will never scroll up past the bottom of the screen, unless there are less entries than lines. When set, the bottom entry may move off the bottom. Patch homepage: http://www.df7cb.de/projects/mutt/ Changelog: menu_context.6: 2004-03-06 new option menu_move_off menu_context.7: 2004-03-20 fixed jumping menu in case menu->max <= menu->pagelen (Thanks to Alain Bench for the report) menu_context.8: 2005-02-27 updated patch for mutt CVS and fixed menu_prev_line and menu_next_line (Thanks to René Clerc for the report) also made <current-middle> honor menu_move_off (spotted by Vincent Lefevre) Christoph Berg <cb@xxxxxxxx> ------------------------------------------------------------------------ diff -urp ../MUTT/mutt/PATCHES mutt/PATCHES --- ../MUTT/mutt/PATCHES 2002-12-09 18:44:54.000000000 +0100 +++ mutt/PATCHES 2005-02-26 23:43:03.000000000 +0100 @@ -0,0 +1 @@ +patch-1.5.8.cb.menu_context.8 diff -urp ../MUTT/mutt/init.h mutt/init.h --- ../MUTT/mutt/init.h 2005-02-12 21:13:20.000000000 +0100 +++ mutt/init.h 2005-02-26 23:45:29.000000000 +0100 @@ -1096,6 +1096,13 @@ struct option_t MuttVars[] = { ** This variable controls the number of lines of context that are given ** when scrolling through menus. (Similar to ``$$pager_context''.) */ + { "menu_move_off", DT_BOOL, R_NONE, OPTMENUMOVEOFF, 0 }, + /* + ** .pp + ** When \fIunset\fP, the bottom entry of menus will never scroll up past + ** the bottom of the screen, unless there are less entries than lines. + ** When \fIset\fP, the bottom entry may move off the bottom. + */ { "menu_scroll", DT_BOOL, R_NONE, OPTMENUSCROLL, 0 }, /* ** .pp diff -urp ../MUTT/mutt/menu.c mutt/menu.c --- ../MUTT/mutt/menu.c 2005-02-12 21:13:20.000000000 +0100 +++ mutt/menu.c 2005-02-27 02:13:54.000000000 +0100 @@ -374,7 +374,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; @@ -396,8 +396,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) @@ -433,10 +433,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; } @@ -451,8 +454,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; } diff -urp ../MUTT/mutt/mutt.h mutt/mutt.h --- ../MUTT/mutt/mutt.h 2005-02-12 21:13:20.000000000 +0100 +++ mutt/mutt.h 2005-02-26 23:42:17.000000000 +0100 @@ -388,6 +388,7 @@ enum OPTMARKERS, OPTMARKOLD, OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ + OPTMENUMOVEOFF, /* allow menu to scroll past last entry */ OPTMETAKEY, /* interpret ALT-x as ESC-x */ OPTMETOO, OPTMHPURGE,
Attachment:
signature.asc
Description: Digital signature