feat: a chosen folder saves at once, and the prompt stays until it has
Choosing where to save a share link's files saves them right away, unless one would replace a file there, which still asks. The folder prompt stays open until they're written: a folder that isn't there, or a save that fails, is said under it in red, to fix the path. Its footer says "enter save", and a file git doesn't ignore is named in the status line after saving. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
3 files changed
+98
-33
No files matched your search
@@ -163,10 +163,23 @@ func TestShareLinkElsewhereAsksWhere(t *testing.T) {
|
||||
if d.m.prompt == nil || d.m.prompt.input == nil || d.m.prompt.input.Value() != dir {
|
||||
t.Fatalf("doesn't ask where, starting from where it runs:\n%s", d.screen())
|
||||
}
|
||||
d.keys("enter", "w")
|
||||
// A folder that isn't there: the prompt stays, saying so.
|
||||
d.m.prompt.input.SetValue(filepath.Join(dir, "nope"))
|
||||
d.keys("enter")
|
||||
if d.m.prompt == nil || d.m.prompt.input == nil || !strings.Contains(d.screen(), "✗ No folder") {
|
||||
t.Fatalf("a missing folder isn't said in the prompt:\n%s", d.screen())
|
||||
}
|
||||
if !strings.Contains(d.screen(), "enter save") {
|
||||
t.Errorf("the footer doesn't say enter saves:\n%s", d.screen())
|
||||
}
|
||||
d.m.prompt.input.SetValue(dir)
|
||||
d.keys("enter") // saved at once: nothing there to replace
|
||||
if b, _ := os.ReadFile(filepath.Join(dir, ".env")); string(b) != "A=1\n" {
|
||||
t.Errorf(".env: %q (%s)", b, d.m.flash.text)
|
||||
}
|
||||
if d.m.prompt != nil || !strings.Contains(d.m.flash.text, "saved 1 file in "+dir) {
|
||||
t.Errorf("not closed with where it saved: %q", d.m.flash.text)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShareLinkGarbled(t *testing.T) {
|
||||
@@ -229,7 +242,7 @@ func TestShareInDemo(t *testing.T) {
|
||||
if d.m.prompt == nil || d.m.prompt.input == nil || !strings.Contains(d.screen(), "isn't among your repos") {
|
||||
t.Fatalf("doesn't ask where:\n%s", d.screen())
|
||||
}
|
||||
d.keys("enter", "w")
|
||||
d.keys("enter") // saved at once: nothing there to replace
|
||||
entries, _ := os.ReadDir(dir)
|
||||
if len(entries) == 0 {
|
||||
t.Fatalf("nothing saved (%s)", d.m.flash.text)
|
||||
|
||||
Reference in new issue
Block a user