Repository navigation
Conversation
Fixes vyncint#828 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.
Keep both integration tests in tests/unsupported.rs, vyncint#877's mode-list test and this branch's overflow test, and the CHANGELOG entries without a blank line between them. Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
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 #828
Once 32 shapes were kept,
Unhandled::recordadded one to the overflow for every report of a shape it did not keep, repeats included. vt100 also reports an SGR or a DEC mode list once for each parameter it declines, soCSI 53 ; 59 mcounted twice. The rustdoc says the overflow counts distinct shapes.I took the issue's first option:
crates/termlens/src/emu/unhandled.rs: past the 32 retained, the record keeps the hashes of the shapes it has counted, at mostMAX_OVERFLOW_TRACKED(256), and counts a shape only the first time. Past 256 such shapes it stops remembering new ones, so the memory stays bounded and a shape it does not remember counts each time, as before.crates/termlens/src/screen.rs: the two doc lines onUnsupportedandoverflow()say that a shape counts once, exactly for the first 256 past the 32, and what happens after that.the_overflow_counts_each_shape_once(the issue's case:CSI 99 hthree times andCSI 53 ; 59 mgive 2) andthe_overflow_remembers_a_bounded_number_of_shapes(the set stops at 256, a remembered shape still counts once, a later one counts again).tests/unsupported.rs,the_overflow_counts_distinct_shapes. Without the change it fails withleft: 5, as in the issue.the_record_is_bounded(8 distinct past 32) still passes.Checked on macOS:
cargo fmt --all --check,cargo clippy -p termlens --all-targets --all-features -- -D warnings,cargo test -p termlens --lib emu::unhandled,cargo test -p termlens --test unsupported,check-dco.shandcheck-no-ai-attribution.sh.Álvaro Alonso
242080768+alvaroalonsoparrondo-a11y@users.noreply.github.com