Re: Shall we have a release?



Leonard den Ottolander wrote:
Hi all,

It would be nice if we could have a new release (4.6.2) in a few weeks.
Although nothing spectacular has changed there have been some
improvements in the last 12 months.

If we agree on a release date I'm prepared to write down a list of
changes.

Please tell us of any urgent issues that need to be fixed before a
release.

The editor currently does not notice when a file is modified outside of its control. This has often lead to overwriting files when I couldn't remember which of my 20+ editor sessions was the one I have edited last.

The patch fixes that.

Roland
Index: editcmd.c
===================================================================
RCS file: /cvsroot/mc/mc/edit/editcmd.c,v
retrieving revision 1.151
diff -u -p -r1.151 editcmd.c
--- editcmd.c	17 Mar 2006 15:41:21 -0000	1.151
+++ editcmd.c	27 Jul 2006 09:57:18 -0000
@@ -276,6 +276,17 @@ edit_save_file (WEdit *edit, const char 
 		return -1;
 	    }
 	}
+
+	/* Prevent overwriting changes from other editor sessions. */
+	if (rv == 0 && edit->stat1.st_mtime != 0 && edit->stat1.st_mtime != sb.st_mtime) {
+	    rv = edit_query_dialog2 (
+		_("Warning"),
+		_("The file has been modified in the meantime. Save anyway?"),
+		_("&Yes"),
+		_("&Cancel"));
+	    if (rv != 0)
+		return -1;
+	}
     }
 
     if (this_save_mode != EDIT_QUICK_SAVE) {
@@ -381,6 +392,10 @@ edit_save_file (WEdit *edit, const char 
 	}
 	if (mc_close (fd))
 	    goto error_save;
+
+	/* Update the file information, especially the mtime. */
+	if (mc_stat (savename, &edit->stat1) == -1)
+	    goto error_save;
     }
 
     if (filelen != edit->last_byte)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]