Repository navigation
rioterm: guard scrolling against a zero sized window - #1975
Open
theluckystrike wants to merge 1 commit into
Open
theluckystrike wants to merge 1 commit into
theluckystrike wants to merge 1 commit into
Conversation
Screen::scroll divided the accumulated scroll by the cell width and height, so a zero sized window turned the scroll into an endless loop (inf as usize) and left the accumulator NaN. Treat a zero or negative dimension as no movement. Refs raphamorim#890
theluckystrike
force-pushed
the
fix/890-zero-size-scroll
branch
from
October 11, 2026 05:38
40a3c3d to
619ffc4
Compare
This branch has not been deployed
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.
Refs #890
Your #1747 already covers the working-dir half of #890, so this PR only fixes the scroll half.
The report's panic was an integer remainder by zero in
screen/mod.rs. That code is floating point on main now, so a zero sized window doesn't panic anymore, butscroll()still divides by the cell height and width, and dividing by zero gives infinity. Cast tousize, that's the largest possible loop count, and the remainder at the end leaves the accumulator NaN for good.Now a zero or negative dimension means no movement, and the accumulator keeps its value. Two small helpers carry the guard, each with a unit test.
cargo test -p riotermpasses (223 tests),cargo fmt --checkis clean, and clippy shows only the warning main already has in rio-vt.Michael