From 9de0f158e2a15a9691412dc8103a704ae932a9fc Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 16 Dec 2016 13:29:34 +0100
Subject: [PATCH] help: keep the same position also after M-\ or M-/ has been
 used

---
 src/help.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/help.c b/src/help.c
index e584b724..f01069c4 100644
--- a/src/help.c
+++ b/src/help.c
@@ -175,28 +175,14 @@ void do_help(void)
 
     display_the_help_text(FALSE);
     curs_set(0);
+    edit_refresh();
 
     while (TRUE) {
-	edit_refresh();
-
 	lastmessage = HUSH;
 	focusing = TRUE;
 
 	kbinput = get_kbinput(edit);
 
-#ifndef NANO_TINY
-	if (kbinput == KEY_WINCH)
-	    continue;
-#endif
-
-#ifndef DISABLE_MOUSE
-	if (kbinput == KEY_MOUSE) {
-	    int mouse_x, mouse_y;
-	    get_mouseinput(&mouse_x, &mouse_y, TRUE);
-	    continue;    /* Redraw the screen. */
-	}
-#endif
-
 	func = parse_help_input(&kbinput);
 
 	if (func == total_refresh) {
@@ -224,6 +210,15 @@ void do_help(void)
 	    do_research();
 	    currmenu = MHELP;
 	    curs_set(1);
+#ifndef NANO_TINY
+	} else if (kbinput == KEY_WINCH) {
+	    ; /* Nothing to do. */
+#endif
+#ifndef DISABLE_MOUSE
+	} else if (kbinput == KEY_MOUSE) {
+	    int dummy_x, dummy_y;
+	    get_mouseinput(&dummy_x, &dummy_y, TRUE);
+#endif
 	} else if (func == do_exit) {
 	    /* Exit from the help viewer. */
 	    close_buffer();
@@ -231,6 +226,8 @@ void do_help(void)
 	} else
 	    unbound_key(kbinput);
 
+	edit_refresh();
+
 	location = 0;
 	line = openfile->fileage;
 
-- 
GitLab