feat(file-manager): move the shell while browsing the panel

Opening a directory in the panel now hands it to the shell, so walking the tree
reads like cd and the two stay on the same directory. The request is still read
at the shell's next prompt, and quitting without validating withdraws a request
the shell has not read yet, so Esc keeps leaving the shell where it was.
This commit is contained in:
BlackAngelTV committed 2026-11-11 08:48:03 +01:00
1 parent e7e4e849eb
commit 5d2e28b144
6 files changed
+88 -18

No files matched your search

+30
View File
@@ -65,6 +65,36 @@ func TestShellHasHookNeedsAPublishedDirectory(t *testing.T) {
}
}
func TestPublishBrowseNeedsTheShellHookAndCanBeWithdrawn(t *testing.T) {
dir := t.TempDir()
h := &Handler{sync: new_shell_sync(dir, "11", true), cwd: dir}
h.publish_browse()
if _, err := os.Stat(filepath.Join(dir, "11.set")); err == nil {
t.Fatal("the panel must not publish before the shell proved it has the hook")
}
if h.sync_published {
t.Fatal("nothing was published")
}
if err := os.WriteFile(filepath.Join(dir, "11"), []byte(dir), 0o600); err != nil {
t.Fatal(err)
}
h.publish_browse()
if got, err := os.ReadFile(filepath.Join(dir, "11.set")); err != nil || string(got) != dir {
t.Fatalf("unexpected request %q (%v)", got, err)
}
if !h.sync_published {
t.Fatal("the request must be remembered so that quitting can withdraw it")
}
h.withdraw_sync_request()
if _, err := os.Stat(filepath.Join(dir, "11.set")); err == nil {
t.Fatal("quitting must withdraw the pending request")
}
if h.sync_published {
t.Fatal("nothing is pending anymore")
}
h.withdraw_sync_request()
}
func TestShellCwdIgnoresUnusablePaths(t *testing.T) {
dir := t.TempDir()
s := new_shell_sync(dir, "9", true)