mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 06:30:28 +09:00
On panic, backup modified buffers only
This commit is contained in:
@@ -352,9 +352,11 @@ func main() {
|
||||
} else {
|
||||
fmt.Println("Micro encountered an error:", errors.Wrap(err, 2).ErrorStack(), "\nIf you can reproduce this error, please report it at https://github.com/zyedidia/micro/issues")
|
||||
}
|
||||
// backup all open buffers
|
||||
// immediately backup all buffers with unsaved changes
|
||||
for _, b := range buffer.OpenBuffers {
|
||||
b.Backup()
|
||||
if b.Modified() {
|
||||
b.Backup()
|
||||
}
|
||||
}
|
||||
exit(1)
|
||||
}
|
||||
|
||||
@@ -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