From 0357c4d552a608ee9e6befa49c8993c8303c0e95 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Wed, 19 Sep 2001 02:59:25 +0000
Subject: [PATCH] - nano.c: main() - Added vars oldcurrent and oldcurrent_x to
 check whether cursor pos has changed and if so update the pos with -c

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog |  4 ++++
 nano.c    | 15 +++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad042e2d..60c57c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@ CVS code -
 	  use a flag instead (just as messy?)
 	- --enable-tiny now leaves out the Auto Indent code, do you really
 	  need that on a bootdisk? =-)
+- nano.c:
+  main()
+	- Added vars oldcurrent and oldcurrent_x to check whether cursor
+	  pos has changed and if so update the pos with -c.
 - nano.texi:
 	- corrected the Mouse Toggle section, noticed by Daniel Bonniot.
 - winio.c:
diff --git a/nano.c b/nano.c
index d7f57951..a27ea5cb 100644
--- a/nano.c
+++ b/nano.c
@@ -608,7 +608,6 @@ int do_mark(void)
 	edit_refresh();
     }
 #endif
-    SET(DISABLE_CURPOS);
     return 1;
 }
 
@@ -2322,8 +2321,6 @@ void do_toggle(int which)
 	    statusbar("%s %s", toggles[which].desc, enabled);
     }
 
-    SET(DISABLE_CURPOS);
-
 #endif
 }
 
@@ -2370,6 +2367,9 @@ int main(int argc, char *argv[])
     int keyhandled;		/* Have we handled the keystroke yet? */
     int i, modify_control_seq;
     char *argv0;
+    filestruct *oldcurrent;	/* Check to constantly update */
+    int oldcurrent_x;		/* Same */
+
 #ifdef _POSIX_VDISABLE
     struct termios term;
 #endif
@@ -2635,6 +2635,8 @@ int main(int argc, char *argv[])
     reset_cursor();
 
     while (1) {
+	oldcurrent = current;
+	oldcurrent_x = current_x;
 
 #ifndef DISABLE_MOUSE
 	currshortcut = main_list;
@@ -2900,12 +2902,9 @@ int main(int argc, char *argv[])
 		}
 		do_char(kbinput);
 	    }
-	if (ISSET(CONSTUPDATE)) {
-	    if (ISSET(DISABLE_CURPOS))
-		UNSET(DISABLE_CURPOS);
-	    else
+	if (ISSET(CONSTUPDATE)) 
+	    if (current != oldcurrent || current_x != oldcurrent_x)
 		do_cursorpos();
-	}
 
 	reset_cursor();
 	wrefresh(edit);
-- 
GitLab