]> git.wh0rd.org Git - nano.git/commitdiff
Cut and renumber fixes
authorChris Allegretta <chrisa@asty.org>
Sun, 10 Dec 2000 05:44:02 +0000 (05:44 +0000)
committerChris Allegretta <chrisa@asty.org>
Sun, 10 Dec 2000 05:44:02 +0000 (05:44 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@400 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
cut.c
nano.c

index 4f3d31f2efab314949c5ce1aaa0c2a1abd73b6d5..506a4477df457f2e154730ff4daa2b1dab127f8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,16 @@
 CVS code -
+- cut.c:
+  do_uncut_text()
+       - Fix renumbering bug when uncutting marked test at filebot.
+       - Fix screen not being displayed when we are uncutting marked
+         text at editbot (Bug discovered by Ken Tyler).
 - files.c:
   write_file()
        - Change open call flags, basically copy joe's way of doing it so
          a more recent version will actually be included in (un)stable.
+- nano.c:
+  renumber()
+       - Dont stupidly assign the value of prev->lineno if prev == NULL!
 
 nano 0.9.23 - 12/08/2000
 General
diff --git a/cut.c b/cut.c
index e7f6aa80de8a37c967e85d2950b6cb77f6e38c61..4b9fc1ae6aa101ec18bb3091cc66af9ec8daf8ef 100644 (file)
--- a/cut.c
+++ b/cut.c
@@ -271,7 +271,7 @@ int do_cut_text(void)
 
 int do_uncut_text(void)
 {
-    filestruct *tmp = current, *fileptr = current, *newbuf, *newend;
+    filestruct *tmp = current, *hold = current, *fileptr = current, *newbuf, *newend;
 #ifndef NANO_SMALL
     char *tmpstr, *tmpstr2;
 #endif
@@ -339,8 +339,12 @@ int do_uncut_text(void)
 
            if (tmp != NULL)
                tmp->prev = newend;
-           else
+           else {
+               /* Fix the editbot pointer too */
+               if (editbot == filebot)
+                   editbot = newend;
                filebot = newend;
+           }
 
            /* Now why don't we update the totsize also */
            for (tmp = current->next; tmp != newend; tmp = tmp->next)
@@ -368,7 +372,9 @@ int do_uncut_text(void)
            current_x = 0;
            placewewant = 0;
        }
-       renumber(current->prev);
+       /* Renumber from BEFORE where we pasted ;) */
+       renumber(hold);
+
        dump_buffer(fileage);
        dump_buffer(cutbuffer);
        set_modified();
diff --git a/nano.c b/nano.c
index e7893fd57167a6ab813a6e7022c695f2924da462..8e1b79e8e1a5199f72645b33ccaa9fcfd38d1af1 100644 (file)
--- a/nano.c
+++ b/nano.c
@@ -315,7 +315,10 @@ int renumber(filestruct * fileptr)
        return 0;
     }
     for (temp = fileptr; temp != NULL; temp = temp->next) {
-       temp->lineno = temp->prev->lineno + 1;
+       if (temp->prev != NULL)
+           temp->lineno = temp->prev->lineno + 1;
+       else
+           temp->lineno = 1;
     }
 
     return 0;