mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 06:45:40 -04:00
save: Update the modification time of the buffer only in case of file changes
This commit is contained in:
parent
49aebe8aca
commit
6164050425
@ -263,12 +263,6 @@ func (b *Buffer) saveToFile(filename string, withSudo bool, autoSave bool) error
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last time this file was updated after saving
|
||||
defer func() {
|
||||
b.ModTime, _ = util.GetModTime(filename)
|
||||
err = b.Serialize()
|
||||
}()
|
||||
|
||||
filename, err = util.ReplaceHome(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -319,6 +313,8 @@ func (b *Buffer) saveToFile(filename string, withSudo bool, autoSave bool) error
|
||||
if errors.Is(err, util.ErrOverwrite) {
|
||||
screen.TermMessage(err)
|
||||
err = errors.Unwrap(err)
|
||||
|
||||
b.UpdateModTime()
|
||||
}
|
||||
return err
|
||||
}
|
||||
@ -335,7 +331,10 @@ func (b *Buffer) saveToFile(filename string, withSudo bool, autoSave bool) error
|
||||
b.Path = filename
|
||||
b.AbsPath = absFilename
|
||||
b.isModified = false
|
||||
b.UpdateModTime()
|
||||
b.ReloadSettings(true)
|
||||
|
||||
err = b.Serialize()
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user