fix: Left/h steps up to the nearest visible ancestor when there's nothing to collapse - #144
Open
HewstonFox wants to merge 1 commit into
Open
fix: Left/h steps up to the nearest visible ancestor when there's nothing to collapse#144HewstonFox wants to merge 1 commit into
HewstonFox wants to merge 1 commit into
Conversation
HewstonFox
force-pushed
the
fix/collapse-walk-up-compact-dirs
branch
from
August 4, 2026 10:15
a8bd8da to
7a3e37c
Compare
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.
Summary
←/h(thecollapseaction) no-oped whenever the selected row had nothing left to collapse: a file, or a directory that was already collapsed. This left the cursor stuck, with no way to keep climbing the tree via Left alone.Changes
src/controller/mod.rs:collapse()now walks up to the nearest visible ancestor directory and collapses that instead of no-op'ing, mirroring how collapsing an expanded directory leaves it selected. Repeated presses climb the tree one level at a time. The walk climbs the real filesystem ancestry rather than stopping after oneparent()hop, so it correctly skips past folded intermediate directories undercompact_dirs(a folded chain likesrc/main/javais a single row keyed on its deepest directory — the immediate filesystem parent has no row of its own).src/tree.rs: addsTreeModel::select(path), a small helper that repositions the cursor onto an already-visible row without expanding ancestors or relaxing filters (unlikereveal) — exactly what's needed right after collapsing an ancestor.tests/controller.rs: two new regression tests — one for the plain already-collapsed-directory case, one specifically for acompact_dirs-folded chain, to lock in that the walk climbs past every folded intermediate row.docs/keys.mdanddocs/usage.md#the-treeto describe the new walk-up behavior, plus aCHANGELOG.mdentry under[Unreleased].Test plan
cargo testis greencargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo auditpassdocs/page) for any user-facing changeRelated