[PR #17353] Account for viewport movement when wrapping over multiple rows #31201

Open
opened 2026-01-31 09:45:46 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17353

State: closed
Merged: Yes


Summary of the Pull Request

When we receive a stream of output at the bottom of the page that wraps
over more than two lines, that is expected to pan the viewport down by
multiple rows to accommodate all of the output. However, when the output
is received in a single write, that did not work correctly.

The problem was that we were reusing a Page instance across multiple
_DoLineFeed calls, and the viewport cached in that Page wasn't valid
after the first call. This PR fixes the issue by adjusting the cached
viewport when we determine it has been moved by _DoLineFeed.

References and Relevant Issues

The bug was introduced in PR #16615 when paging support was added.

Validation Steps Performed

I've verified that the test case in #17351 is now working correctly, and
have added a unit test covering this scenario.

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17353 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request When we receive a stream of output at the bottom of the page that wraps over more than two lines, that is expected to pan the viewport down by multiple rows to accommodate all of the output. However, when the output is received in a single write, that did not work correctly. The problem was that we were reusing a `Page` instance across multiple `_DoLineFeed` calls, and the viewport cached in that `Page` wasn't valid after the first call. This PR fixes the issue by adjusting the cached viewport when we determine it has been moved by `_DoLineFeed`. ## References and Relevant Issues The bug was introduced in PR #16615 when paging support was added. ## Validation Steps Performed I've verified that the test case in #17351 is now working correctly, and have added a unit test covering this scenario. ## PR Checklist - [x] Closes #17351 - [x] Tests added/passed
claunia added the pull-request label 2026-01-31 09:45:46 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31201