refactor(tui): extract _select_origin_widget helper - #376
Open
EthanGuo-coder wants to merge 1 commit into
Open
Conversation
EthanGuo-coder
force-pushed
the
fix/issue-373
branch
from
May 15, 2026 07:15
09b68b9 to
38013e3
Compare
EthanGuo-coder
force-pushed
the
fix/issue-373
branch
from
July 25, 2026 06:49
38013e3 to
1ef062c
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.
The previous head was based on
fc6b5ad, which is no longer inmain's history after the recent force-push, so this PR was rendering a bogus 250-commit / 100-file diff against an ancient merge base. Re-applied cleanly on top of4086d5c. The test file the original description mentioned has been dropped, since the tree carries no test suite and no pytest dependency.Changes:
_patch_auto_scroll_for_selectioninto a module-level_select_origin_widget(screen)helper at the top of the# ---------- App ----------section. The call site becomes a one-liner..startbefore dereferencing it. This is future-proofing rather than a fix for a currently reachable state:SelectState.startis non-optional in Textual 8.2.6, so the existingselect_state.start.containercannot raise on any shape Textual produces today. The guard only means that a future private-API change degrades to "no extra auto-scroll candidate" instead of anAttributeErrorraised inside a mouse-move handler.No behaviour change on any input Textual produces today. Verified by running the current inline implementation and the helper side by side over a 20-case matrix covering every presence / absence /
Nonecombination of_select_state,_select_state.startand_select_start: 12 cases identical, and the only 8 differences are exactly the guard described above — the inline version raisesAttributeError, the helper returnsNone. An empty_select_starttuple still raisesIndexErrorin both, unchanged.Refs #373, #379