From fdec2a1d2d298bedfe251efd825a12223a7b7edc Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 15 Apr 2014 19:28:11 +0000
Subject: [PATCH] Adding M-\ and M-/ for First and Last Line to the help
 viewer.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4778 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    |  4 ++++
 src/global.c | 16 ++++++++--------
 src/help.c   |  2 --
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b5b3b59..f19d3f35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
 	* src/*.c: Normalize whitespace around '==' comparison.
 	* configure.ac: Check for the availability of snprintf(),
 	fixes Savannah bug #42070 reported by David Lawrence Ramsey.
+	* src/global.c (shortcut_init), src/help.c (do_help): Add the
+	shortcuts M-\ and M-/ for First Line and Last Line to the help
+	viewer, instead of ^Y and ^V, which are already taken for Page
+	Up and Page Down.  Also, stop them from aborting the viewer.
 
 2014-04-14  Benno Schulenberg  <bensberg@justemail.net>
 	* src/{proto.h,cut.c,nano.c,text.c}: Remove the unused parameter
diff --git a/src/global.c b/src/global.c
index f1ae3b06..ca226b43 100644
--- a/src/global.c
+++ b/src/global.c
@@ -835,10 +835,10 @@ void shortcut_init(void)
 #endif
 
     add_to_funcs(do_first_line,
-	(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
+	(MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
 	first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
     add_to_funcs(do_last_line,
-	(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
+	(MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
 	last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
 
     add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS),
@@ -1179,13 +1179,13 @@ void shortcut_init(void)
     add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
 	"M-R", regexp_void, 0, FALSE);
 
-    add_to_sclist(MMAIN, "M-\\", do_first_line, 0, TRUE);
-    add_to_sclist(MMAIN, "M-|", do_first_line, 0, TRUE);
-    add_to_sclist(MMAIN, "M-/", do_last_line, 0, TRUE);
-    add_to_sclist(MMAIN, "M-?", do_last_line, 0, TRUE);
-    add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP,
+    add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0, TRUE);
+    add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0, TRUE);
+    add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0, TRUE);
+    add_to_sclist(MMAIN|MHELP, "M-?", do_last_line, 0, TRUE);
+    add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE,
 	"^Y", do_first_line, 0, TRUE);
-    add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP,
+    add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE,
 	"^V", do_last_line, 0, TRUE);
 
 #ifndef DISABLE_BROWSER
diff --git a/src/help.c b/src/help.c
index da643509..9c170a58 100644
--- a/src/help.c
+++ b/src/help.c
@@ -164,13 +164,11 @@ void do_help(void (*refresh_func)(void))
 	} else if (f->scfunc == do_first_line) {
 		if (meta_key)
 		    line = 0;
-		break;
 	} else if (f->scfunc == do_last_line) {
 		if (meta_key) {
 		    if (line + (editwinrows - 1) < last_line)
 			line = last_line - (editwinrows - 1);
 		}
-		break;
 	    /* Abort the help browser. */
 	} else if (f->scfunc == do_exit) {
 		abort = TRUE;
-- 
GitLab