From 1c46551ce86505adba4c0b4a3e4bdac161a1c280 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 31 Dec 2016 12:38:10 +0100 Subject: [PATCH] cut: indicate a buffer as modified only if actually something was deleted This fixes https://savannah.gnu.org/bugs/?49962. --- src/cut.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cut.c b/src/cut.c index bfb9a87d..4c447087 100644 --- a/src/cut.c +++ b/src/cut.c @@ -125,6 +125,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof) * before we add text to it. */ bool old_no_newlines = ISSET(NO_NEWLINES); #endif + size_t was_totsize = openfile->totsize; assert(openfile->current != NULL && openfile->current->data != NULL); @@ -197,6 +198,8 @@ void do_cut_text(bool copy_text, bool cut_till_eof) UNSET(NO_NEWLINES); } else #endif /* !NANO_TINY */ + /* Only set the modification flag if actually something was cut. */ + if (openfile->totsize != was_totsize) set_modified(); refresh_needed = TRUE;