From b516d8e3f3f263454c08cf31a8326824ed2c32c7 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Wed, 3 Oct 2001 00:01:36 +0000
Subject: [PATCH] - nano.c:main() - Added var constcheck as a CRC-like check of
 whether cursor pos has changed and if so update the pos with -c

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

diff --git a/ChangeLog b/ChangeLog
index 41eb5531..8e2fea0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,7 +44,7 @@ CVS code -
 	- Initialize totsize (DLR).
 - nano.c:
   main()
-	- Added vars oldcurrent and oldcurrent_x to check whether cursor
+	- Added var constcheck as a CRC-like check of whether cursor
 	  pos has changed and if so update the pos with -c.
 	- Many tweaks and changes from numerics to char equivs
 	  (David Lawrence Ramsey).
diff --git a/nano.c b/nano.c
index 0ca7c18e..d91ff69b 100644
--- a/nano.c
+++ b/nano.c
@@ -2448,8 +2448,7 @@ 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 */
+    long constcheck;	/* Check to constantly update */
 
 #ifdef _POSIX_VDISABLE
     struct termios term;
@@ -2752,8 +2751,7 @@ int main(int argc, char *argv[])
     reset_cursor();
 
     while (1) {
-	oldcurrent = current;
-	oldcurrent_x = current_x;
+	constcheck = current->lineno + current_x + totsize;
 
 #ifndef DISABLE_MOUSE
 	currshortcut = main_list;
@@ -3035,7 +3033,7 @@ int main(int argc, char *argv[])
 	if (ISSET(DISABLE_CURPOS))
 	    UNSET(DISABLE_CURPOS);
 	else if (ISSET(CONSTUPDATE))
-	    if (current != oldcurrent || current_x != oldcurrent_x)
+	if (constcheck != current->lineno + current_x + totsize)
 		do_cursorpos();
 
 	reset_cursor();
-- 
GitLab