tui: the panes are a folding tree, driven by one click - #39
Merged
Conversation
The first pass at the mouse copied a file manager from 1990: a click moved the cursor and a double-click walked into a directory, replacing the listing with a new one. That is not what a mouse user expects from a pane of files today. They expect the directory to open in place, under its own name, on one click, and to close the same way, with the rest of the listing still on screen around it. And they expect the row under the pointer to say so. Each pane is now that tree: - One click on a directory unfolds it: its listing is fetched (locally, or over the same SFTP session for a server) and drawn indented beneath it, nested as deep as you like. The marker on the row carries the state: ▸ folded, ▾ unfolded, … while the listing is on its way. The next click folds it again, and the listing is kept so unfolding is instant. A directory that cannot be read says so on the status line and stays folded. - One click on a file selects it. One click on `..` goes up. - The row under the pointer is lit, a shade lighter than the background, and goes out when the pointer leaves the rows. The frame's own tree hears the pointer only while it is inside, so the app's mouse listener notices the move that no row claimed. - The keyboard walks the same tree: → unfolds a folded directory and steps onto the first child of an unfolded one, ← folds the directory under the cursor, else climbs to its parent row, else leaves the root. ⏎ toggles. Double-click is gone; nothing needs it. The pane's state grew a `children` map (listing by relative path), an `unfolded` set, a `listing` set and a `hover` index; `visibleRows` flattens the tree in draw order, which is what the cursor indexes and what a click lands on. The view draws it with hqtui 0.5.1's tree, whose new `onRow` callback and `hovered` option are what made this possible. The interaction tests now unfold a real directory made on disk under `tmpdir`, click into its nested directory, fold the parent, walk it with the arrow keys, and prove the hover lights and goes out. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWtLsmAescX4Nb8QiBJd37
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWtLsmAescX4Nb8QiBJd37
pnpm's minimumReleaseAge policy holds new packages for a day, and the local install had already written the exclusion for our own hqtui into the workspace file; this commits it so the frozen install in CI agrees. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DWtLsmAescX4Nb8QiBJd37
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #38 after trying it: a listing that is replaced on a double-click is not what a mouse user expects from a pane of files. They expect a folding tree, one click, and a row that lights up under the pointer.
Each pane is now that tree, on hqtui 0.5.1 (profullstack/hqtui#87, released for this):
▸folded,▾unfolded,…while the listing is on its way. The next click folds it; the listing is kept so unfolding again is instant. An unreadable directory says so on the status line and stays folded...goes up. Double-click is gone.→unfolds, or steps onto the first child of an unfolded directory;←folds, else climbs to the parent row, else leaves the root;⏎toggles.The pane's state grew a
childrenmap, anunfoldedset, alistingset and ahoverindex;visibleRowsflattens the tree in draw order, which is what the cursor indexes and what a click lands on.The interaction tests unfold a real directory made under
tmpdir, click into its nested directory, fold the parent, walk it with the arrow keys, and prove the hover lights and goes out.Verified:
pnpm build,pnpm -r typecheck,pnpm testagainst the published@profullstack/hqtui@0.5.1.🤖 Generated with Claude Code
https://claude.ai/code/session_01DWtLsmAescX4Nb8QiBJd37