From aea4dabf5985012a8ed4cb09d823cd18497ddbfa Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 13 Jul 2004 17:09:24 +0000
Subject: [PATCH] per DB's patch, remove some unneeded reset_cursor() calls,
 move the one in the main input loop to the top, and remove the apparently
 unneeded wrefresh() call in the main input loop

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

diff --git a/ChangeLog b/ChangeLog
index 69d2ed6b..eb365fbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,8 @@ CVS code -
 	  errors.  Also exit instead of calling usage() in the event of
 	  an invalid fill value, for consistency with how an invalid
 	  tabsize value is handled.
+	- Remove several unnecessary reset_cursor() calls. (David
+	  Benbennick)
 - files.c:
   close_open_file()
 	- Tweak to no longer rely on the return values of
@@ -65,6 +67,10 @@ CVS code -
 	  the same line. (DLR)
   do_exit()
 	- Tweak for efficiency. (David Benbennick)
+  main()
+	- Move the reset_cursor() call to the beginning of the main
+	  input loop, and remove the apparently unnecessary wrefresh()
+	  call. (David Benbennick)
 - proto.h:
 	- Change the variables in the prototypes for do_justify(),
 	  get_verbatim_kbinput(), and get_mouseinput() to match the ones
diff --git a/src/nano.c b/src/nano.c
index cada0949..a8bc1b33 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2652,7 +2652,6 @@ void do_justify(int full_justify)
     /* Display the shortcut list with UnJustify. */
     shortcut_init(TRUE);
     display_main_list();
-    reset_cursor();
 
     /* Now get a keystroke and see if it's unjustify; if not, unget the
      * keystroke and return. */
@@ -3519,11 +3518,11 @@ int main(int argc, char *argv[])
 #endif
 
     edit_refresh();
-    reset_cursor();
 
     while (TRUE) {
 	keyhandled = FALSE;
 
+	reset_cursor();
 	if (ISSET(CONSTUPDATE))
 	    do_cursorpos(TRUE);
 
@@ -3642,8 +3641,6 @@ int main(int argc, char *argv[])
 			do_char((char)kbinput);
 	    }
 	}
-	reset_cursor();
-	wrefresh(edit);
     }
     assert(FALSE);
 }
diff --git a/src/winio.c b/src/winio.c
index 080f47d2..95c40800 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2707,9 +2707,6 @@ void edit_refresh(void)
 	    nlines++;
 	}
 	reset_cursor();
-
-	/* What the hell are we expecting to update the screen if this
-	 * isn't here?  Luck? */
 	wrefresh(edit);
     }
 }
@@ -2997,8 +2994,6 @@ void do_cursorpos(int constant)
 
     old_i = i;
     old_totsize = totsize;
-
-    reset_cursor();
 }
 
 void do_cursorpos_void(void)
-- 
GitLab