Repository navigation
Halt a running glide before a landing that finds the pane already in place - #188
Merged
Merged
Conversation
…place A match landing scrolls with `scroll_to_region`, which measures from the pane's live position and issues nothing when the delta is zero. Textual only stops a running scroll animation inside `_scroll_to`, so a landing that found the pane already where it wanted it left an earlier glide running, and the preview ended on the earlier target. Down then Up in the results list, the second press landing before the first glide had moved the pane, left the preview on the table with the cursor on the section above it. `MatchAwareScroll.halt_glide` drops a running `scroll_y` animation where it is (animating to the current value, which avoids `force_stop_animation`'s jump to the old target), and the match landing and the n/b stop scroll call it first. Under the test harness the race reproduces at a 50 ms gap (2 of 4 on main, 0 of 28 with this change); a live terminal did not hit it in 83 tries, since there the glide has usually moved before the second landing.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
scroll_to_region, which measures from the pane's live position and issues nothing on a zero delta. Textual stops a running scroll animation only inside_scroll_to, which a zero-delta call never reaches, so the earlier glide ran on.scroll_to_region(y=65)is followed by no scroll call, while the first landing's was followed byscroll_relativeandscroll_to.Fix
MatchAwareScroll.halt_glide()drops a runningscroll_yanimation where it is: animating to the current value makes Textual pop it, which avoidsforce_stop_animation's jump to the old target. It also resetsscroll_target_y, which Reading View'sj/kstep from.StructuralScrollStrategy._scroll_pane_to_match_region) and the n/b stop scroll (MatchNavigator._scroll_to_stop) call it first.Tests
test_a_scroll_to_where_the_pane_already_is_still_ends_a_glide[landing|nb_stop]: main fails it 3 of 3 (assert 0 == 52), this branch passes 3 of 3.make batch-close: ruff, pyright, 4916 passed / 3 skipped, tmux harness green.Known limits
_scroll_tois queued withcall_after_refresh, so for 1 to 17 ms it is neither running nor scheduled, andhalt_glidesees nothing to stop. The review confirmed this at a seam that starts the first glide the production way, but could not trigger it from key presses. Closing it meansMatchAwareScrolldropping a stale queued scroll when a new landing arrives, which changes deferred-scroll behaviour for every caller, so it is left out of this change.on_complete, so Textual's_realtime_animation_countgains one per halt. That count only gatesPAUSE_GC_ON_SCROLL, which is off and never set in fnd.