From 372bd0f7dddad712945f0c86dce9e46b811914b0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 3 Dec 2016 17:47:37 +0100
Subject: [PATCH] screen: switch the cursor back on only in the main loop

This fixes https://savannah.gnu.org/bugs/?49750.
---
 src/nano.c  | 6 ++++--
 src/winio.c | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/nano.c b/src/nano.c
index a1e1370b..93ea9c0e 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2707,14 +2707,16 @@ int main(int argc, char **argv)
 	if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
 	    do_cursorpos(TRUE);
 
-	/* Refresh either just the cursor or the entire edit window. */
+	/* Refresh just the cursor position or the entire edit window. */
 	if (!refresh_needed) {
 	    reset_cursor();
-	    curs_set(1);
 	    wnoutrefresh(edit);
 	} else
 	    edit_refresh();
 
+	/* Make sure the cursor is visible. */
+	curs_set(1);
+
 	focusing = TRUE;
 
 	/* Forget any earlier statusbar x position. */
diff --git a/src/winio.c b/src/winio.c
index 3b59cc37..6d68bbf1 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3018,7 +3018,6 @@ void edit_refresh(void)
 	blank_line(edit, nlines, 0, COLS);
 
     reset_cursor();
-    curs_set(1);
     wnoutrefresh(edit);
 
     refresh_needed = FALSE;
-- 
GitLab