mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
On panic, backup modified buffers only
This commit is contained in:
@@ -55,9 +55,11 @@ func startup(args []string) (tcell.SimulationScreen, error) {
|
||||
if err := recover(); err != nil {
|
||||
screen.Screen.Fini()
|
||||
fmt.Println("Micro encountered an error:", err)
|
||||
// backup all open buffers
|
||||
// immediately backup all buffers with unsaved changes
|
||||
for _, b := range buffer.OpenBuffers {
|
||||
b.Backup()
|
||||
if b.Modified() {
|
||||
b.Backup()
|
||||
}
|
||||
}
|
||||
// Print the stack trace too
|
||||
log.Fatalf(errors.Wrap(err, 2).ErrorStack())
|
||||
|
||||
Reference in New Issue
Block a user