Skip to content

Commit 8c883c6

Browse files
committed
backup: Rearrange and extend BackupMsg
1 parent c4dcef3 commit 8c883c6

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

cmd/micro/micro.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func checkBackup(name string) error {
230230
input, err := os.ReadFile(backup)
231231
if err == nil {
232232
t := info.ModTime()
233-
msg := fmt.Sprintf(buffer.BackupMsg, t.Format("Mon Jan _2 at 15:04, 2006"), backup)
233+
msg := fmt.Sprintf(buffer.BackupMsg, target, t.Format("Mon Jan _2 at 15:04, 2006"), backup)
234234
choice := screen.TermPrompt(msg, []string{"r", "i", "a", "recover", "ignore", "abort"}, true)
235235

236236
if choice%3 == 0 {

internal/buffer/backup.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ import (
1414
"github.com/zyedidia/micro/v2/internal/util"
1515
)
1616

17-
const BackupMsg = `A backup was detected for this file. This likely means that micro
18-
crashed while editing this file, or another instance of micro is currently
19-
editing this file.
17+
const BackupMsg = `A backup was detected for:
2018
21-
The backup was created on %s, and the file is
19+
%s
20+
21+
This likely means that micro crashed while editing this file,
22+
or another instance of micro is currently editing this file,
23+
or an error occurred while saving this file so it may be corrupted.
24+
25+
The backup was created on %s and its path is:
2226
2327
%s
2428
@@ -131,7 +135,7 @@ func (b *Buffer) ApplyBackup(fsize int64) (bool, bool) {
131135
if err == nil {
132136
defer backup.Close()
133137
t := info.ModTime()
134-
msg := fmt.Sprintf(BackupMsg, t.Format("Mon Jan _2 at 15:04, 2006"), backupfile)
138+
msg := fmt.Sprintf(BackupMsg, b.Path, t.Format("Mon Jan _2 at 15:04, 2006"), backupfile)
135139
choice := screen.TermPrompt(msg, []string{"r", "i", "a", "recover", "ignore", "abort"}, true)
136140

137141
if choice%3 == 0 {

0 commit comments

Comments
 (0)