Repository navigation
Conversation
Backspace already reaches handleGoUp (4002073), but handleGoUp collapsed the parent of the highlighted node: a no-op on a top-level directory, it hid the directory just opened on a nested one, left the selection on an unrelated row, and split paths on '/' although buildFileTree joins them with the platform separator, so on Windows it never did anything. Collapse the highlighted directory when it is open, otherwise move the selection to the parent row found with path.dirname. List the key in the tree view's help line and update the docs table. Closes Nano-Collective#1455
nc-review: comments — 2 nits@addyCooks — a few things worth a look, none blocking. PR #1500 correctly addresses issue #1455 and the deeper issues the author uncovered: Backspace in ⚪ nit ·
⚪ nit · The new test relies on a hard-coded 50ms / 30ms delay around 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
|
Heads up for review: this builds on 4002073, which already routes Backspace to This also touches the end of |
…1455 # Conflicts: # source/components/file-explorer/index.spec.tsx
Closes #1455 (part of #907)
Description
4002073 made the physical Backspace key reach
handleGoUpin tree mode (key.backspace || key.delete), which was the root cause named in the issue. But the handler behind it still didn't do what the issue expects ("collapses the current directory / moves the selection up a level"), so the issue's own repro steps still did nothing:node.pathon/, butbuildFileTreebuilds paths withpath.join, which uses\there, so it never found a parent.Backspace now follows the usual tree-view convention:
path.dirname, which splits on the same separatorpath.joinused to build the path.source/components/file-explorer/index.tsxhandleGoUpcollapses an open directory, otherwise selects the parent row; help line listsBackspace: upsource/components/file-explorer/index.spec.tsxdocs/features/file-explorer.mdRecording
Type of Change
Changeset
.changeset/explorer-backspace-go-up.md, patch)Testing
FileExplorerin a temp directory (outer/inner/file.txt,top.txt), opens both directories, highlights the file, then presses Backspace four times: file →inner(still open) →innercollapsed →outer→outercollapsed. It checks the status-bar path and visible rows at each step. Onmainit fails: after Backspace on the file, the frame is unchanged.file-explorer/index(20/20),tree-item,utilsandfile-treespecs passtsc, Biome format and lint, and knip cleanChecklist