]> git.wh0rd.org Git - nano.git/commitdiff
Marking the current buffer as mofified only when actually something
authorBenno Schulenberg <bensberg@justemail.net>
Tue, 1 Dec 2015 11:39:04 +0000 (11:39 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Tue, 1 Dec 2015 11:39:04 +0000 (11:39 +0000)
was inserted.  This fixes Savannah bug #45409.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5458 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index df06329071c5a7689d2553c21d00ba1bb492d3c2..3f20969c6b4b9827b1f3db821c7ee817e781182d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-12-01  Benno Schulenberg  <bensberg@justemail.net>
+       * src/files.c (do_insertfile): Mark the buffer as mofified only when
+       actually something was inserted.  This fixes Savannah bug #45409.
+
 2015-11-30  Benno Schulenberg  <bensberg@justemail.net>
        * src/text.c (redo_cut, update_undo): When cutting reaches the EOF,
        and NONEWLINES is set, there is no next line at which to put the
index 4631cd2f06b5b0104963ca4987523626c57d194a..08b86e1681cf38fb25e4e1f8a04a65099b1bfb14 100644 (file)
@@ -1041,6 +1041,7 @@ void do_insertfile(
     char *ans = mallocstrcpy(NULL, "");
        /* The last answer the user typed at the statusbar prompt. */
     filestruct *edittop_save = openfile->edittop;
+    ssize_t was_current_lineno = openfile->current->lineno;
     size_t current_x_save = openfile->current_x;
     ssize_t current_y_save = openfile->current_y;
     bool edittop_inside = FALSE;
@@ -1280,8 +1281,10 @@ void do_insertfile(
                /* Restore the old place we want. */
                openfile->placewewant = pww_save;
 
-               /* Mark the file as modified. */
-               set_modified();
+               /* Mark the file as modified if it changed. */
+               if (openfile->current->lineno != was_current_lineno ||
+                       openfile->current_x != current_x_save)
+                   set_modified();
 
                /* Update the screen. */
                edit_refresh();