Index: src/global.c =================================================================== --- src/global.c (revision 5366) +++ src/global.c (working copy) @@ -172,6 +172,9 @@ subnfunc *uncutfunc; /* Pointer to the special Uncut/Unjustify item. */ +int start_from = 0; + /* The number of the shortcut at which the help lines start. */ + #ifndef DISABLE_HISTORIES filestruct *search_history = NULL; /* The search string history list. */ @@ -603,6 +606,7 @@ N_("Suspend the editor (if suspension is enabled)"); #ifndef NANO_TINY const char *nano_savefile_msg = N_("Save file without prompting"); + const char *nano_rolllines_msg = N_("Roll the help lines"); const char *nano_findprev_msg = N_("Search next occurrence backward"); const char *nano_findnext_msg = N_("Search next occurrence forward"); const char *nano_case_msg = @@ -935,6 +939,9 @@ add_to_funcs(do_savefile, MMAIN, N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW); + add_to_funcs(roll_help_lines, MMAIN, + N_("Roll help"), IFSCHELP(nano_rolllines_msg), BLANKAFTER, VIEW); + add_to_funcs(do_findprevious, MMAIN, N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW); add_to_funcs(do_findnext, MMAIN, @@ -1158,6 +1165,8 @@ add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND); #endif /* !NANO_TINY */ + add_to_sclist(MMAIN, "M-;", roll_help_lines, 0); + add_to_sclist(MMAIN, "^Q", xon_complaint, 0); add_to_sclist(MMAIN, "^S", xoff_complaint, 0); @@ -1456,6 +1465,8 @@ s->scfunc = total_refresh; else if (!strcasecmp(input, "suspend")) s->scfunc = do_suspend_void; + else if (!strcasecmp(input, "rollhelplines")) + s->scfunc = roll_help_lines; else if (!strcasecmp(input, "casesens")) s->scfunc = case_sens_void; #ifndef NANO_TINY Index: src/proto.h =================================================================== --- src/proto.h (revision 5366) +++ src/proto.h (working copy) @@ -139,6 +139,8 @@ extern char *homedir; +extern int start_from; + typedef void (*functionptrtype)(void); /* All functions in browser.c. */ @@ -793,6 +795,7 @@ void titlebar(const char *path); extern void set_modified(void); void statusbar(const char *msg, ...); +void roll_help_lines(void); void bottombars(int menu); void onekey(const char *keystroke, const char *desc, size_t len); void reset_cursor(void); Index: src/winio.c =================================================================== --- src/winio.c (revision 5366) +++ src/winio.c (working copy) @@ -2299,6 +2299,20 @@ 26; } +/* "Scroll" the help lines a bunch of items to the left. */ +void roll_help_lines(void) +{ + if (start_from == 0) + start_from += 2; + + start_from += MAIN_VISIBLE - 4; + + if (start_from >= length_of_list(currmenu)) + start_from = 0; + + bottombars(currmenu); +} + /* Display the shortcut list in s on the last two rows of the bottom * portion of the window. */ void bottombars(int menu) @@ -2306,6 +2320,7 @@ size_t i, colwidth, slen; subnfunc *f; const sc *s; + int leftmost = start_from; /* Set the global variable to the given menu. */ currmenu = menu; @@ -2313,18 +2328,19 @@ if (ISSET(NO_HELP)) return; - if (menu == MMAIN) { + slen = length_of_list(menu); + + if (leftmost > slen) + leftmost = 0; + + if (slen > MAIN_VISIBLE) slen = MAIN_VISIBLE; - assert(slen <= length_of_list(menu)); - } else { - slen = length_of_list(menu); + /* If not at the beginning, reduce the number of items, to give + * each item a little more space. */ + if (leftmost > 0) + slen = slen - 2; - /* Don't show any more shortcuts than the main list does. */ - if (slen > MAIN_VISIBLE) - slen = MAIN_VISIBLE; - } - /* There will be this many characters per column, except for the * last two, which will be longer by (COLS % colwidth) columns so as * to not waste space. We need at least three columns to display @@ -2337,7 +2353,7 @@ fprintf(stderr, "In bottombars, and slen == \"%d\"\n", (int) slen); #endif - for (f = allfuncs, i = 0; i < slen && f != NULL; f = f->next) { + for (f = allfuncs, i = 0; i < leftmost + slen && f != NULL; f = f->next) { #ifdef DEBUG fprintf(stderr, "Checking menu items...."); @@ -2355,6 +2371,14 @@ #endif continue; } + + if (i == (leftmost - 1)) { + i = 0; + leftmost = 0; + blank_bottombars(); + continue; + } + wmove(bottomwin, 1 + i % 2, (i / 2) * colwidth); #ifdef DEBUG fprintf(stderr, "Calling onekey with keystr \"%s\" and desc \"%s\"\n", s->keystr, f->desc);