Menu

#674 No "File has been modified" alert on save

Completed
closed
SciTE (280)
3
2014-09-20
2010-03-23
Anonymous
No

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".

Discussion

  • Neil Hodgson

    Neil Hodgson - 2010-03-23

    I won't be working on this myself but will accept a well-written patch that implements it as an option.

     
  • Neil Hodgson

    Neil Hodgson - 2010-03-23
    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
     
  • Andrey Moskalyov

    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;
    + }
    + }
    }

        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();

     
  • Neil Hodgson

    Neil Hodgson - 2010-04-12
    • milestone: --> Completed
     
  • Neil Hodgson

    Neil Hodgson - 2010-04-12

    Committed. AsFileSystem no longer available so substituted AsInternal.

     
  • Neil Hodgson

    Neil Hodgson - 2010-06-02
    • status: open --> closed
     

Log in to post a comment.