Repository navigation
core: a key fold in a tree stays folded - #649
Merged
Merged
Conversation
A branch treated init_options.expanded as a controlled value, so a Left/Right fold was undone in the same frame whenever the caller passed a stale open state. The caller's value now drives the branch only when it changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016JNGGzdR8958EwaYZWPz9w
foxnne
marked this pull request as ready for review
October 19, 2026 16:29
Left/Right set `expanded` in `install()`, before `expander()` compared it with the caller's `init_options.expanded`, which the caller has not yet read back: the fold was undone in the same frame. The previous take kept the caller's last value and drove the branch only on a change, which lost a caller's change made during the close animation, stopped hover auto-open on a branch a filter forces open, and broke clearing a search back to the saved state. Instead the key asks for a toggle and `expander()` takes it beside `clicked`: one path, animated, and the caller's value keeps meaning what it did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Generated by Claude Code |
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.
Folding a tree branch with Left/Right stuck in every tree (settings, files, guides):
Branch.expandercomparedinit_options.expandedwith the widget's own state every frame, so a caller passing its (stale) open value undid the key fold in the same frame.Fix (
core/widgets/TreeWidget.zig): Left/Right no longer setexpandedininstall(), beforeexpander()compares it with a caller value the caller has not read back yet. The key asks for a toggle (key_toggle), andexpander()takes it besideclicked: one path, animated as a click is, and the caller reads the new state back the same frame. The caller'sexpandedkeeps its meaning (a filter forcing a branch open, hover auto-open, clearing a search back to the saved state).Not done: the shared open-branches helper replacing the hand-written maps (
guides/List.zigunfolded,SettingsTreeopen_branches, …) is left as a follow-up; this PR is the bug fix only.Test:
tests/integration.zig, "tree: a key fold stays folded when the caller passes its open state back" — a caller that keeps its open state and readsbranch.expandedback, as the settings, file and guides trees do: Left folds (animated: the body is still drawn the frame after), stays folded, Right opens again.Review (PM reviewer pass)
code-reviewat medium found the first take (drive the branch from the caller's value only when it changes) lost a caller's change made during the close animation, stopped hover auto-open on a branch a filter forces open, and broke clearing a search back to the saved state; and key folds did not animate. Replaced by the key-toggle fix above, which removes all four at the root. The shared open-branches helper stays a follow-up.Local gates on macOS (this reviewer):
scripts/check-fmt.sh,zig build test-integration(81/81 steps) ,zig build,zig build test(115/115 steps),zig build check-web: all pass. No fizzy launched.Verified (original author)
ci-okall passed; "Example repos (Linux)" was still running when this was marked ready.Part of: bug found reviewing #628.
🤖 Generated with Claude Code
https://claude.ai/code/session_016JNGGzdR8958EwaYZWPz9w