Lines that wrap on space characters at the bottom of the buffer (“new bottom line”) receive an extra line break #7446

Closed
opened 2026-01-31 01:04:19 +00:00 by claunia · 3 comments
Owner

Originally created by @DHowett-MSFT on GitHub (Apr 17, 2020).

Originally assigned to: @DHowett-MSFT on GitHub.

With 0.11.xxx selfhost builds, The following steps reliably result in visual corruption (and also drove me a little crazy!)

  1. Terminal width = 120
  2. Go to the terminal source tree
  3. git blame 862793299a src/types/UiaTextRangeBase.cpp
  4. Search for GetTextRects using /:
    • /GetTextRects<CR>
  5. Go to the next match, using n.
  6. Notice that GetTextRects, which should be on the top line, is gone.
  7. Move right, left (arrow keys), and notice that it reappears.

bad

image

good

image

If you look at the bad image, I highlighted two things that caught my eye. Those are lines that have spaces in column 121, before less hard wraps them (!) I don't have 121 columns ...

Confirmed this in a text editor with the debug tap. I highlighted in blue the same regions that caused a break here.

The vertical strip under the cursor (look for the blue boxes) indicates column 121. Most of the escape sequences for cursor movement start here, but in the boxed areas they're not escapes.

image

Is this the exact wrap issue? Except with conpty sending spaces instead?

Originally created by @DHowett-MSFT on GitHub (Apr 17, 2020). Originally assigned to: @DHowett-MSFT on GitHub. With 0.11.xxx selfhost builds, The following steps reliably result in visual corruption (and also drove me a little crazy!) 1. Terminal width = 120 2. Go to the terminal source tree 3. `git blame 862793299a src/types/UiaTextRangeBase.cpp` 4. Search for `GetTextRects` using `/`: * `/GetTextRects<CR>` 5. Go to the next match, using `n`. 6. Notice that `GetTextRects`, which should be on the top line, is _gone_. 7. Move right, left (arrow keys), and notice that it reappears. ### bad ![image](https://user-images.githubusercontent.com/14316954/79520213-0976d600-800b-11ea-9468-5c24ddb10bce.png) ### good ![image](https://user-images.githubusercontent.com/14316954/79520220-0f6cb700-800b-11ea-8e1d-52b506a3d06f.png) If you look at the bad image, I highlighted two things that caught my eye. Those are lines that have spaces _in column 121_, before `less` hard wraps them (!) I don't have 121 columns ... Confirmed this in a text editor with the debug tap. I highlighted in blue the same regions that caused a break here. The vertical strip under the cursor (look for the blue boxes) indicates column _121_. Most of the escape sequences for cursor movement start here, but in the boxed areas they're not escapes. ![image](https://user-images.githubusercontent.com/14316954/79520364-78ecc580-800b-11ea-813b-5b006599ab3c.png) Is this the exact wrap issue? Except with conpty sending spaces instead?
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 17, 2020):

issue_5386_tap.txt

@DHowett-MSFT commented on GitHub (Apr 17, 2020): [issue_5386_tap.txt](https://github.com/microsoft/terminal/files/4490393/issue_5386_tap.txt)
Author
Owner

@zadjii-msft commented on GitHub (Apr 17, 2020):

I'm not sure, but I can take a look Monday? Unless you think this should interrupt the DX work I'm on now.

Either this is exact wrap, or more likely, this is an exclusive/inclusive thing. There's one spot in PaintBufferLine that's always been an ExclusiveRight that I've always thought should be an InclusiveRight, and maybe the other conpty changes finally broke that line.

@zadjii-msft commented on GitHub (Apr 17, 2020): I'm not sure, but I can take a look Monday? Unless you think this should interrupt the DX work I'm on now. Either this is exact wrap, or more likely, this is an exclusive/inclusive thing. There's one spot in `PaintBufferLine` that's always been an `ExclusiveRight` that I've always thought should be an `InclusiveRight`, and maybe the other conpty changes finally broke that line.
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 17, 2020):

Got this down to a perfect repo.

  1. New bottom line
  2. Print width-1 chars followed by a space
  3. Print something else

ConPTY will duplicate the single space into two spaces, causing a wrap on the Terminal side.

@DHowett-MSFT commented on GitHub (Apr 17, 2020): Got this down to a perfect repo. 1. New bottom line 2. Print width-1 chars followed by a space 3. Print something else ConPTY will duplicate the single space into two spaces, causing a wrap on the Terminal side.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7446