From 9c3249c8932a3e8e099e85f5697fe024fc564662 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 1 Jul 2005 22:58:47 +0000
Subject: [PATCH] minor cosmetic and constant cursor position display fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2806 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 13 +++++++++++++
 src/files.c |  2 ++
 src/nano.c  | 19 +++++++++++--------
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c2c788b4..4c4c1998 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
 CVS code -
+- General:
+	- Miscellaneous comment fixes. (DLR)
+- nano.c:
+  allow_pending_sigwinch()
+	- Simplify by using the "?" operator instead of an if clause.
+	  (DLR)
+  do_verbatim_input()
+	- If constant cursor position display is on when we finish, make
+	  sure the cursor position is displayed properly. (DLR)
+  main()
+	- When constant cursor position display is on, only display the
+	  cursor position if there are no keys waiting in the buffer.
+	  (DLR)
 
 GNU nano 1.3.8 - 2005.06.30
 - General:
diff --git a/src/files.c b/src/files.c
index 3ca03e55..c4bd3265 100644
--- a/src/files.c
+++ b/src/files.c
@@ -2339,6 +2339,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
 		if ((match + 1) % columns == 0)
 		    editline++;
 	    }
+
 	    wrefresh(edit);
 	    *list = TRUE;
 	}
@@ -2899,6 +2900,7 @@ char *histfilename(void)
     return nanohist;
 }
 
+/* Load histories from ~/.nano_history. */
 void load_history(void)
 {
     char *nanohist = histfilename();
diff --git a/src/nano.c b/src/nano.c
index c6a8eb60..5da58473 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1299,6 +1299,11 @@ void do_verbatim_input(void)
     do_output(output, kbinput_len, TRUE);
 
     free(output);
+
+    /* If constant cursor position display is on, make sure the current
+     * cursor position is properly displayed on the statusbar. */
+    if (ISSET(CONST_UPDATE))
+	do_cursorpos(TRUE);
 }
 
 void do_backspace(void)
@@ -3683,10 +3688,7 @@ void allow_pending_sigwinch(bool allow)
     sigset_t winch;
     sigemptyset(&winch);
     sigaddset(&winch, SIGWINCH);
-    if (allow)
-	sigprocmask(SIG_UNBLOCK, &winch, NULL);
-    else
-	sigprocmask(SIG_BLOCK, &winch, NULL);
+    sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
 }
 #endif /* !NANO_SMALL */
 
@@ -3911,7 +3913,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
 
 	if (have_shortcut) {
 	    switch (input) {
-		/* Handle the "universal" statusbar prompt shortcuts. */
+		/* Handle the "universal" edit window shortcuts. */
 		case NANO_XON_KEY:
 		    statusbar(_("XON ignored, mumble mumble."));
 		    break;
@@ -4682,9 +4684,10 @@ int main(int argc, char **argv)
 	/* Make sure the cursor is in the edit window. */
 	reset_cursor();
 
-	/* If constant cursor position display is on, display the
-	 * current cursor position on the statusbar. */
-	if (ISSET(CONST_UPDATE))
+	/* If constant cursor position display is on, and there are no
+	 * keys waiting in the buffer, display the current cursor
+	 * position on the statusbar. */
+	if (ISSET(CONST_UPDATE) && get_buffer_len() == 0)
 	    do_cursorpos(TRUE);
 
 	currshortcut = main_list;
-- 
GitLab