From 5c2b44a48a79a049b6f939eed7c2a5ebce055635 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 15 Apr 2014 20:01:19 +0000 Subject: [PATCH] Adding shortcut ^L for Refresh to the help viewer, to be able to position ^X Exit as the very first. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4780 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/global.c | 19 +++++++++---------- src/help.c | 3 +-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55b98550..965e668f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ viewer, instead of ^Y and ^V, which are already taken for Page Up and Page Down. Also, stop them from aborting the viewer. * src/help.c (do_help): Remove superfluous abortion variable. + * src/global.c (shortcut_init), src/help.c (do_help): Add the + shortcut ^L for Refresh to the help viewer and stop it aborting; + a changed version of patch #7013 from David Lawrence Ramsey. 2014-04-14 Benno Schulenberg * src/{proto.h,cut.c,nano.c,text.c}: Remove the unused parameter diff --git a/src/global.c b/src/global.c index ca226b43..d09d4151 100644 --- a/src/global.c +++ b/src/global.c @@ -306,7 +306,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h #endif #ifdef DEBUG - fprintf(stderr, "Added func \"%s\"\n", f->desc); + fprintf(stderr, "Added func %ld (%s) for menus %x\n", (long)func, f->desc, menus); #endif } @@ -791,6 +791,12 @@ void shortcut_init(void) nano_justify_msg, TRUE, NOVIEW); #endif +#ifndef DISABLE_HELP + add_to_funcs(do_exit, MHELP, exit_msg, nano_exit_msg, FALSE, VIEW); + + add_to_funcs(total_refresh, MHELP, refresh_msg, nano_refresh_msg, FALSE, VIEW); +#endif + add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER, prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER, @@ -985,7 +991,7 @@ void shortcut_init(void) IFSCHELP(nano_wordcount_msg), FALSE, VIEW); #endif - add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, + add_to_funcs(total_refresh, MMAIN, refresh_msg, IFSCHELP(nano_refresh_msg), FALSE, VIEW); add_to_funcs(do_suspend_void, MMAIN, suspend_msg, @@ -1062,13 +1068,6 @@ void shortcut_init(void) } #endif /* !NANO_TINY */ -#ifndef DISABLE_HELP - add_to_funcs(edit_refresh, MHELP, - refresh_msg, nano_refresh_msg, FALSE, VIEW); - - add_to_funcs(do_exit, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); -#endif - #ifndef DISABLE_BROWSER add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE), first_file_msg, IFSCHELP(nano_firstfile_msg), FALSE, VIEW); @@ -1255,7 +1254,7 @@ void shortcut_init(void) add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0, FALSE); add_to_sclist(MINSERTFILE, "^X", ext_cmd_void, 0, FALSE); add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE); - add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE); + add_to_sclist(MMAIN|MHELP, "^L", total_refresh, 0, FALSE); add_to_sclist(MALL, "^I", do_tab, 0, TRUE); add_to_sclist(MALL, "^M", do_enter_void, 0, TRUE); add_to_sclist(MALL, "kenter", do_enter_void, 0, TRUE); diff --git a/src/help.c b/src/help.c index d54ea2c6..f32e1a79 100644 --- a/src/help.c +++ b/src/help.c @@ -142,9 +142,8 @@ void do_help(void (*refresh_func)(void)) if (!f) continue; - if (f->scfunc == total_refresh) { + if (f->scfunc == total_refresh) { total_redraw(); - break; } else if (f->scfunc == do_page_up) { if (line > editwinrows - 2) line -= editwinrows - 2;