Repository navigation
fix(wait): name the pattern and the dropped frames in a timeout - #881
Merged
vyncint merged 2 commits intoNov 27, 2026
Conversation
Fixes vyncint#840 Signed-off-by: Álvaro Alonso <242080768+alvaroalonsoparrondo-a11y@users.noreply.github.com>
vyncint
previously approved these changes
Nov 27, 2026
vyncint
left a comment
Owner
There was a problem hiding this comment.
Reviewed against the issue; CI is green. Thank you.
Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com> # Conflicts: # CHANGELOG.md
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.
Fixes #840
Two timeouts left out what they waited for:
wait_until_matchesreusedwait_until's message, "the screen predicate to hold", so a failed regex wait never said which pattern it was.wait_frametimeout after a burst longer than the 8-frame ring said "20 complete frames observed", which reads as twenty frames the predicate rejected. Only the newest eight were ever offered to it.Changes, in
crates/termlens/src/terminal.rs:wait_until_matches_fornow goes throughwait_screen_innerwith a description,a row matching``.wait_screen_deadlinekeeps its signature and passes no description, so every other wait reads as before. `wait_screen_inner` already returns the screen the predicate held on, so the method still returns the matched instant, and the `Screen::clone` the old closure made is gone.wait_frame_deadlinetracks the next frame index past the cursor it has not offered yet. Each time it looks at the ring, any gap between that index and the oldest frame still kept is counted as dropped. On a timeout, a non-zero count is added inside the parenthesis:(20 complete frames observed; 12 of them left the ring before a wait could see them, since only the newest 8 are kept). The same note is added to the "since the last one returned" and "since the resize" forms. Frames the wait did offer are never counted, even when they leave the ring later.Tests, each failing on main:
tests/search.rs,wait_until_matches_returns_the_screen_it_matched: the existing timeout now also asserts that the first line namesa row matching `never \d+`.tests/frames.rs,a_timeout_after_a_long_burst_says_how_many_frames_were_dropped: the issue's 20-frame burst. The timeout says 12 left the ring and only the newest 8 are kept, and the oldest frame still offered isFRAME 13. Ignored on Windows like its neighbours (Unix only: what Windows support would actually take #149).CHANGELOG: entry under Unreleased → Fixed.
Checked on macOS:
cargo fmt --all --check,cargo clippy -p termlens --all-targets --all-features -- -D warningsand with--no-default-features,cargo test -p termlens --all-features --test frames --test search --test timeouts,check-dco.shandcheck-no-ai-attribution.sh.Álvaro Alonso
242080768+alvaroalonsoparrondo-a11y@users.noreply.github.com