From 5b83d7df51f9d2cddd62467288105b38d28cb292 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 17 Apr 2015 09:42:04 +0000
Subject: [PATCH] Binding the unbound Home and End keys to goto_top and
 goto_bottom in the Help Viewer and the File Browswer, to mimic the behaviour
 of these keys in file viewers and web browsers.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5201 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    |  5 +++++
 src/global.c | 16 ++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7b7b69a6..ba2c25e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 	* src/text.c (do_alt_speller, do_linter, do_formatter): Distinguish
 	a failure to launch the linter from receiving zero parsable lines;
 	add a new function to glue together the invocation-error string.
+	* src/global.c (shortcut_init): In the Help Viewer and File Browswer,
+	bind the unbound Home and End keys to goto_top and goto_bottom, to
+	mimic the behaviour of these keys in file viewers and web browsers.
+	Also show ^Y and ^V in the WhereisFile menu instead of M-\ and M-/,
+	for similarity with the WhereIs menu.
 
 GNU nano 2.4.1 - 2015.04.14
 2015-04-13  Benno Schulenberg  <bensberg@justemail.net>
diff --git a/src/global.c b/src/global.c
index 82c82e8b..76b22d68 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1059,10 +1059,10 @@ void shortcut_init(void)
     add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
     add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
 #endif
-    add_to_sclist(MMOST, "^A", do_home, 0);
-    add_to_sclist(MMOST, "Home", do_home, 0);
-    add_to_sclist(MMOST, "^E", do_end, 0);
-    add_to_sclist(MMOST, "End", do_end, 0);
+    add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0);
+    add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0);
+    add_to_sclist((MMOST & ~MBROWSER), "^E", do_end, 0);
+    add_to_sclist((MMOST & ~MBROWSER), "End", do_end, 0);
     add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0);
     add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
     add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
@@ -1155,12 +1155,14 @@ void shortcut_init(void)
     add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", get_history_newer_void, 0);
 #endif
 #ifndef DISABLE_BROWSER
+    add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
+    add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
-    add_to_sclist(MWHEREISFILE, "^Y", do_first_file, 0);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
     add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
-    add_to_sclist(MWHEREISFILE, "^V", do_last_file, 0);
+    add_to_sclist(MBROWSER, "Home", do_first_file, 0);
+    add_to_sclist(MBROWSER, "End", do_last_file, 0);
     add_to_sclist(MBROWSER, "^_", goto_dir_void, 0);
     add_to_sclist(MBROWSER, "M-G", goto_dir_void, 0);
     add_to_sclist(MBROWSER, "F13", goto_dir_void, 0);
@@ -1178,6 +1180,8 @@ void shortcut_init(void)
     add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
 #ifndef DISABLE_HELP
     add_to_sclist(MHELP, "^G", do_exit, 0);
+    add_to_sclist(MHELP, "Home", do_first_line, 0);
+    add_to_sclist(MHELP, "End", do_last_line, 0);
 #endif
     add_to_sclist(MMOST, "^I", do_tab, 0);
     add_to_sclist(MMOST, "^M", do_enter_void, 0);
-- 
GitLab