When I save a file that has been modified before by another user, editor does not alert me about it.
I think it should be a question from editor: "save it anyway" or "do not save".
// Returns false if cancelled or failed to save
bool SciTEBase::Save() {
if (!filePath.IsUntitled()) {
+ GUI::gui_string msg;
+ int decision;
+
if (props.GetInt("save.deletes.first")) {
filePath.Remove();
+ } else if (props.GetInt("save.check.modified.time")) {
+ time_t newModTime = filePath.ModifiedTime();
+ if ((newModTime != 0) && (CurrentBuffer()->fileModTime != 0) && (newModTime != CurrentBuffer()->fileModTime)) {
+ msg = LocaliseMessage("The file '^0' has been modified outside SciTE. Should it be saved?", filePath.AsFileSystem());
+ decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
+ if (decision == IDNO) {
+ return false;
+ }
+ }
}
if \(SaveBuffer\(filePath\)\) \{
CurrentBuffer\(\)->SetTimeFromFile\(\);
wEditor.Call\(SCI\_SETSAVEPOINT\);
if \(IsPropertiesFile\(filePath\)\) \{
ReloadProperties\(\);
\}
\} else \{
- GUI::gui_string msg = LocaliseMessage(
- "Could not save file '^0'. Save under a different name?", filePath.AsInternal());
- int decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
+ msg = LocaliseMessage(
+ "Could not save file '^0'. Save under a different name?", filePath.AsFileSystem());
+ decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
if (decision == IDYES) {
return SaveAsDialog();
}
return false;
}
return true;
} else {
return SaveAsDialog();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I won't be working on this myself but will accept a well-written patch that implements it as an option.
Index: SciTEIO.cxx
RCS file: /cvsroot/scintilla/scite/src/SciTEIO.cxx,v
retrieving revision 1.158
diff -u -8 -p -r1.158 SciTEIO.cxx
--- SciTEIO.cxx 30 Mar 2010 22:39:59 -0000 1.158
+++ SciTEIO.cxx 11 Apr 2010 17:44:28 -0000
@@ -849,30 +849,42 @@ void SciTEBase::ReloadProperties() {
SetWindowName();
BuffersMenu();
Redraw();
}
// Returns false if cancelled or failed to save
bool SciTEBase::Save() {
if (!filePath.IsUntitled()) {
+ GUI::gui_string msg;
+ int decision;
+
if (props.GetInt("save.deletes.first")) {
filePath.Remove();
+ } else if (props.GetInt("save.check.modified.time")) {
+ time_t newModTime = filePath.ModifiedTime();
+ if ((newModTime != 0) && (CurrentBuffer()->fileModTime != 0) && (newModTime != CurrentBuffer()->fileModTime)) {
+ msg = LocaliseMessage("The file '^0' has been modified outside SciTE. Should it be saved?", filePath.AsFileSystem());
+ decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
+ if (decision == IDNO) {
+ return false;
+ }
+ }
}
- GUI::gui_string msg = LocaliseMessage(
- "Could not save file '^0'. Save under a different name?", filePath.AsInternal());
- int decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
+ msg = LocaliseMessage(
+ "Could not save file '^0'. Save under a different name?", filePath.AsFileSystem());
+ decision = WindowMessageBox(wSciTE, msg, MB_YESNO | MB_ICONWARNING);
if (decision == IDYES) {
return SaveAsDialog();
}
return false;
}
return true;
} else {
return SaveAsDialog();
Committed. AsFileSystem no longer available so substituted AsInternal.