Wrapping over multiple lines in a single write fails in conhost #21797

Closed
opened 2026-01-31 07:55:09 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Jun 1, 2024).

Windows Terminal version

Commit 4a243f0445

Windows build number

10.0.19045.4412

Other Software

No response

Steps to reproduce

  1. Open a bash shell in a recent build of OpenConsole.
  2. Make sure you have some scrollback enabled.
  3. Set the width to 80 columns
  4. Execute the following statement:
    printf "\e[2J\e[999;70HFirst line Second line                                                                     Third line\e[H"
    

Expected Behavior

That should output a string a text wrapping over three lines, starting at the bottom of the page, so the viewport scrolls up by two rows. It should look something like this:

image

Actual Behavior

The third line doesn't scroll the viewport, but instead wraps up onto the previous line (i.e. the first line), ending up like this:

image

This was a regression caused by PR #16615. The problem is that we're reusing the same Page object in multiple _DoLineFeed calls, but when a scroll is triggered (specifically one that pans the viewport), the viewport coordinates stored in the Page object are no longer correct. I'm working on a PR to fix this.

Note that this doesn't appear to affect Windows Terminal, because it doesn't have any scrollback in conhost, so the viewport doesn't move.

Originally created by @j4james on GitHub (Jun 1, 2024). ### Windows Terminal version Commit 4a243f044572146e18e0051badb1b5b3f3c28ac8 ### Windows build number 10.0.19045.4412 ### Other Software _No response_ ### Steps to reproduce 1. Open a bash shell in a recent build of OpenConsole. 2. Make sure you have some scrollback enabled. 3. Set the width to 80 columns 4. Execute the following statement: ``` printf "\e[2J\e[999;70HFirst line Second line Third line\e[H" ``` ### Expected Behavior That should output a string a text wrapping over three lines, starting at the bottom of the page, so the viewport scrolls up by two rows. It should look something like this: ![image](https://github.com/microsoft/terminal/assets/4181424/fdc0b8c1-e386-4485-8259-e8600b544a44) ### Actual Behavior The third line doesn't scroll the viewport, but instead wraps up onto the previous line (i.e. the first line), ending up like this: ![image](https://github.com/microsoft/terminal/assets/4181424/b4b341b7-5fbb-4792-9b6b-8143ffb02f5a) This was a regression caused by PR #16615. The problem is that we're reusing the same `Page` object in multiple `_DoLineFeed` calls, but when a scroll is triggered (specifically one that pans the viewport), the viewport coordinates stored in the `Page` object are no longer correct. I'm working on a PR to fix this. Note that this doesn't appear to affect Windows Terminal, because it doesn't have any scrollback in conhost, so the viewport doesn't move.
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 07:55:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21797