From 95b0b5249a24214c1b5c762c887aaf9868a910e7 Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Fri, 28 Jul 2000 02:58:06 +0000
Subject: [PATCH] edit_refresh()->edit_update() redundancy

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@142 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   |  4 ++++
 cut.c       |  4 ++--
 po/nano.pot | 26 +++++++++++++-------------
 winio.c     |  7 ++++++-
 4 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 08b4ed7d..2b0933f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,10 @@ CVS code
   replace_abort()
 	- redundant, now just calls search abort until it does something
 	  different.  
+- winio.c:
+  edit_refresh()
+	- Added check for current line "running" off the screen.
+	  Hopefully this will not cause any recursive lockups.
 
 nano-0.9.14 - 07/27/2000
 - nano.h:
diff --git a/cut.c b/cut.c
index 6491220b..4509d663 100644
--- a/cut.c
+++ b/cut.c
@@ -122,7 +122,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
 	    filebot = top;
 	}
     }
-    if (top->lineno < edittop->lineno)
+     if (top->lineno < edittop->lineno)
 	edit_update(top);
 }
 #endif
@@ -406,7 +406,7 @@ int do_uncut_text(void)
 
     i = editbot->lineno;
     renumber(newbuf);
-    if (i < newend->lineno)
+     if (i < newend->lineno)
 	edit_update(fileptr);
 
     dump_buffer_reverse(fileptr);
diff --git a/po/nano.pot b/po/nano.pot
index c234aa7a..bff9624b 100644
--- a/po/nano.pot
+++ b/po/nano.pot
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-07-27 21:54-0400\n"
+"POT-Creation-Date: 2000-07-27 22:58-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -344,7 +344,7 @@ msgid "Case Sens"
 msgstr ""
 
 #: global.c:282 global.c:301 global.c:311 global.c:327 global.c:331
-#: global.c:337 winio.c:997
+#: global.c:337 winio.c:1002
 msgid "Cancel"
 msgstr ""
 
@@ -758,50 +758,50 @@ msgstr ""
 msgid "Modified"
 msgstr ""
 
-#: winio.c:913
+#: winio.c:918
 #, c-format
 msgid "Moved to (%d, %d) in edit buffer\n"
 msgstr ""
 
-#: winio.c:924
+#: winio.c:929
 #, c-format
 msgid "current->data = \"%s\"\n"
 msgstr ""
 
-#: winio.c:967
+#: winio.c:972
 #, c-format
 msgid "I got \"%s\"\n"
 msgstr ""
 
-#: winio.c:992
+#: winio.c:997
 msgid "Yes"
 msgstr ""
 
-#: winio.c:994
+#: winio.c:999
 msgid "All"
 msgstr ""
 
-#: winio.c:996
+#: winio.c:1001
 msgid "No"
 msgstr ""
 
-#: winio.c:1132
+#: winio.c:1137
 #, c-format
 msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
 msgstr ""
 
-#: winio.c:1136
+#: winio.c:1141
 msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
 msgstr ""
 
-#: winio.c:1260
+#: winio.c:1265
 msgid "Dumping file buffer to stderr...\n"
 msgstr ""
 
-#: winio.c:1262
+#: winio.c:1267
 msgid "Dumping cutbuffer to stderr...\n"
 msgstr ""
 
-#: winio.c:1264
+#: winio.c:1269
 msgid "Dumping a buffer to stderr...\n"
 msgstr ""
diff --git a/winio.c b/winio.c
index a53c0b94..d3551a6d 100644
--- a/winio.c
+++ b/winio.c
@@ -822,7 +822,7 @@ void center_cursor(void)
 /* Refresh the screen without changing the position of lines */
 void edit_refresh(void)
 {
-    int lines = 0, i = 0;
+    int lines = 0, i = 0, currentcheck = 0;
     filestruct *temp, *hold = current;
 
     if (current == NULL)
@@ -833,9 +833,14 @@ void edit_refresh(void)
     while (lines <= editwinrows - 1 && lines <= totlines && temp != NULL) {
 	hold = temp;
 	update_line(temp, current_x);
+	if (temp == current)
+	    currentcheck = 1;
+
 	temp = temp->next;
 	lines++;
     }
+    if (!currentcheck) /* Then current has run off the screen... */
+	edit_update(current);
 
     if (lines <= editwinrows - 1)
 	while (lines <= editwinrows - 1) {
-- 
GitLab