]> git.wh0rd.org Git - nano.git/commitdiff
Not recording files that have the default cursor position.
authorBenno Schulenberg <bensberg@justemail.net>
Sun, 7 Feb 2016 12:49:42 +0000 (12:49 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Sun, 7 Feb 2016 12:49:42 +0000 (12:49 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5615 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index c80b4ecdec4acd6897186933d0d6f01e1ead91e7..a23ff7a6c3cbf3bcc82f27626c9a1e7407cceca8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-02-07  Benno Schulenberg  <bensberg@justemail.net>
+       * src/files.c (update_poshistory): Don't put files in the history list
+       when they have the default cursor position (line 1, column 1).
+
 2016-02-06  Benno Schulenberg  <bensberg@justemail.net>
        * src/files.c (write_file): Remove the --nofollow option that hasn't
        been working for a dozen years.
index fc2f961dfda1db1f68b791abb143c2250c6f3187..8895bc9f402d705e5814cdb2d4ca3578b3d624d2 100644 (file)
@@ -3212,6 +3212,20 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
        posprev = posptr;
     }
 
+    /* Don't record files that have the default cursor position. */
+    if (lineno == 1 && xpos == 1) {
+       if (posptr != NULL) {
+           if (posprev == NULL)
+               position_history = posptr->next;
+           else
+               posprev->next = posptr->next;
+           free(posptr->filename);
+           free(posptr);
+       }
+       free(fullpath);
+       return;
+    }
+
     theone = posptr;
 
     /* If we didn't find it, make a new node; otherwise, if we're