mirror of
https://github.com/microsoft/terminal.git
synced 2026-03-27 20:00:51 -04:00
## Summary of the Pull Request This PR clamp the "new rows" scrolling value to a positive number. We can't create a negative number of new rows. It also adds a test. ## References ## PR Checklist * [x] Closes #5540 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments The origin of this bug is that as newlines are emitted, we'll accumulate an enormous scroll delta into a selection region, to the point of overflowing a `SHORT`. When the overflow occurs, the `Terminal` would fail to send a `NotifyScroll()` to the `TermControl` hosting it. For this bug to repro, we need to: - Have a sufficiently large buffer, because each newline we'll accumulate a delta of (0, ~bufferHeight), so (bufferHeight^2 + bufferHeight) > SHRT_MAX - Have a selection ## Validation Steps Performed * Dustin verified this actually * Created a new insane test case