fix(directory-picker-browse): keep the typed level in the last pane

Skipping the draft-following scan whenever ANY pane happened to list the
directory was the cheaper rule and the wrong one: erasing a segment left the
level being typed on the LEFT, with its own child pane still standing to its
right, so the two panes stopped reading as "where I am, and where I came
from".

The pane arity is now the invariant the editor maintains — the last pane lists
the level the path names, its parent sits beside it, and only a display root
lists alone. Only that last pane's own tail costs no scan; every other
directory part re-lands.
This commit is contained in:
creatixchu
2026-08-03 13:27:45 +08:00
parent 233ea50104
commit 2ceed380dd
9 changed files with 59 additions and 30 deletions

View File

@@ -423,11 +423,14 @@ describe('web e2e: workspace management (create / rename / flat view / hover aff
await expect.poll(() => dialog.getByText('only-under-alpha', { exact: true }).count(), { timeout: 10_000 }).toBe(1)
expect(await dialog.getByRole('list').count()).toBe(2)
expect(await path.inputValue()).toBe(`${join(staged, 'alpha')}${sep}`)
// Erasing back past the separator returns to a level already on screen:
// the tail filters it, no scan needed, both panes stay.
// Erasing back past the separator walks the panes up, so the level being
// typed is the last pane again (its children no longer stand to its
// right) and the tail filters it.
await path.fill(`${staged}${sep}al`)
await expect.poll(() => dialog.getByText('beta', { exact: true }).count(), { timeout: 10_000 }).toBe(0)
await expect.poll(() => dialog.getByText('only-under-alpha', { exact: true }).count(), { timeout: 10_000 }).toBe(0)
expect(await dialog.getByText('alpha', { exact: true }).count()).toBe(1)
expect(await dialog.getByText('beta', { exact: true }).count()).toBe(0)
expect(await dialog.getByRole('list').count()).toBe(2)
// A tail nobody matches is a name still being spelled: the level shows
// whole instead of emptying under it.
await path.fill(`${staged}${sep}zzz`)