From 36c5228a6c1c97d9e0826045c97bba84db4e6cec Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 6 Nov 2023 22:07:38 -0700 Subject: [PATCH] oop --- cmd/edit.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/edit.go b/cmd/edit.go index 6781893..b3ee25e 100644 --- a/cmd/edit.go +++ b/cmd/edit.go @@ -53,10 +53,15 @@ func _edit(filepaths func() []string) error { for _, editedFile := range editedFiles { edits[path.Base(editedFile)] = editedFile originalFile := func() string { + last := "" for _, f := range filepaths() { if path.Base(f) == path.Base(editedFile) { return f } + last = f + } + if last != "" { + return path.Join(path.Dir(last), path.Base(editedFile)) } panic("how?") }()