From 95add8dabe4d49415aa972263e53f4db333029af Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Tue, 21 Oct 2008 10:20:07 +0000 Subject: [PATCH] 2008-10-20 Chris Allegretta * files.c (do_writeout): Add check for file modification when saving the file so the user can at least know they may be blowing away changes. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4344 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 36c011ee..3e59d1b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-10-20 Chris Allegretta + * files.c (do_writeout): Add check for file modification when saving + the file so the user can at least know they may be blowing away changes. + 2008-10-14 Chris Allegretta * nanorc.5: Fix redo man page entry and update explanation, reported by Eitan Adler diff --git a/src/files.c b/src/files.c index f1444b55..def24d72 100644 --- a/src/files.c +++ b/src/files.c @@ -2028,6 +2028,13 @@ bool do_writeout(bool exiting) continue; } } + if (openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) { + i = do_yesno_prompt(FALSE, + _("File was modified since you opened it, continue saving ? ")); + if (i == 0 || i == -1) + continue; + } + } /* Convert newlines to nulls, just before we save the