"git log --pretty=oneline" at the bottom of the buffer line-wraps wrong #7864

Closed
opened 2026-01-31 01:14:29 +00:00 by claunia · 4 comments
Owner

Originally created by @DHowett-MSFT on GitHub (May 1, 2020).

Originally assigned to: @zadjii-msft on GitHub.

The pager prints one screen-width of line, then enters deferred EOL mode, then prints more. When we were in the newBottomLine state (or whatever it is now), we fail to re-wrap it properly.

image

Originally created by @DHowett-MSFT on GitHub (May 1, 2020). Originally assigned to: @zadjii-msft on GitHub. The pager prints one screen-width of line, then enters deferred EOL mode, then prints more. When we were in the `newBottomLine` state (or whatever it is now), we fail to re-wrap it properly. ![image](https://user-images.githubusercontent.com/14316954/80832075-d99a0780-8ba0-11ea-8ad4-871e469bea7a.png)
Author
Owner

@DHowett-MSFT commented on GitHub (May 1, 2020):

If you move the pager right then left it corrects itself.

@DHowett-MSFT commented on GitHub (May 1, 2020): If you move the pager right then left it corrects itself.
Author
Owner

@zadjii-msft commented on GitHub (May 5, 2020):

Debugging Notes

image

  • Debug tap output: (broken manually on LF)
8a15b2f69b8920a66948420cc7628e5be55e295a␣␛[mdoc:␣fix␣typo␣in␣␛[30;41H␍␊
UsingCommandlineArguments.md␣(#5714)␍␊
␛[33m6cbc2e5fa435faf445af2ef203bee118e0caedc6␣␛[mremove␣decreaseFo␛[30;41H␍␊
ntSize␣from␣schema␣(#5712)␍␊
␛[33m44689b93a296a933e0e0f2c9801dda6cf32caa97␣(␛[91mado/master␛[33m)␣␛[mRemo␛[30;54H␛[?25l␍␊
ve␣the␣(Preview)␣tag␣from␣the␣primary␣App␣Name␣(#5679)␣␣␣␣␛[30;55H␛[?25h␍␊
␛[33mb6e46c0dc1cce8c35c7217650a19e8835b30e75d␣␛[mAdd␣tooltip␣text␣␛[30;41H␍␊
to␣New␣Tab/Min/Max/Close␣(#5484)␍␊
:
  • Copies as:
8a15b2f69b8920a66948420cc7628e5be55e295a doc: fix typo in
UsingCommandlineArguments.md (#5714)
6cbc2e5fa435faf445af2ef203bee118e0caedc6 remove decreaseFo
ntSize from schema (#5712)
44689b93a296a933e0e0f2c9801dda6cf32caa97 (ado/master) Remo
ve the (Preview) tag from the primary App Name (#5679)
b6e46c0dc1cce8c35c7217650a19e8835b30e75d Add tooltip text
to New Tab/Min/Max/Close (#5484)

Curiosities:

  • the ␛[30;41H␍␊ after decreaseFo
  • the ␛[30;54H (no CRLF) after Remo
  • the ␛[30;41H␍␊ after Add tooltip text
  • the SHAs are 40 chars long
  • We're manually placing the cursor at the start of the last run of a line when we hit this weird case
@zadjii-msft commented on GitHub (May 5, 2020): ### Debugging Notes ![image](https://user-images.githubusercontent.com/18356694/81090751-d1550b80-8ec3-11ea-874b-de942c85a4d7.png) * Debug tap output: (broken manually on LF) ``` 8a15b2f69b8920a66948420cc7628e5be55e295a␣␛[mdoc:␣fix␣typo␣in␣␛[30;41H␍␊ UsingCommandlineArguments.md␣(#5714)␍␊ ␛[33m6cbc2e5fa435faf445af2ef203bee118e0caedc6␣␛[mremove␣decreaseFo␛[30;41H␍␊ ntSize␣from␣schema␣(#5712)␍␊ ␛[33m44689b93a296a933e0e0f2c9801dda6cf32caa97␣(␛[91mado/master␛[33m)␣␛[mRemo␛[30;54H␛[?25l␍␊ ve␣the␣(Preview)␣tag␣from␣the␣primary␣App␣Name␣(#5679)␣␣␣␣␛[30;55H␛[?25h␍␊ ␛[33mb6e46c0dc1cce8c35c7217650a19e8835b30e75d␣␛[mAdd␣tooltip␣text␣␛[30;41H␍␊ to␣New␣Tab/Min/Max/Close␣(#5484)␍␊ : ``` * Copies as: ``` 8a15b2f69b8920a66948420cc7628e5be55e295a doc: fix typo in UsingCommandlineArguments.md (#5714) 6cbc2e5fa435faf445af2ef203bee118e0caedc6 remove decreaseFo ntSize from schema (#5712) 44689b93a296a933e0e0f2c9801dda6cf32caa97 (ado/master) Remo ve the (Preview) tag from the primary App Name (#5679) b6e46c0dc1cce8c35c7217650a19e8835b30e75d Add tooltip text to New Tab/Min/Max/Close (#5484) ``` Curiosities: * the `␛[30;41H␍␊` after `decreaseFo` * the `␛[30;54H` (no CRLF) after `Remo` * the `␛[30;41H␍␊` after `Add tooltip text ` * the SHAs are 40 chars long * We're manually placing the cursor at the _start_ of the last run of a line when we hit this weird case
Author
Owner

@zadjii-msft commented on GitHub (May 6, 2020):

Alright, new day, new findings.

I've been writing test cases all day, and I can't seem to get one that repros this case exactly. Today, I'm trying to debug through more as this happens, as opposed to psychically writing a test that repros how I would implement this application's behavior.

I think perhaps part of what I was getting wring in the tests is breaking the writes into multiple writes during the course of this test.

Possibly also, I'm using the StateMachine to print chars to the buffer, which uses WCL with WC_LIMIT_BACKSPACE | WC_DELAY_EOL_WRAP, and less is definitely not using WC_DELAY_EOL_WRAP here. They're only using WC_LIMIT_BACKSPACE (0x10).

When this happens, less is writing some text that's longer than the width of the buffer to the last line of the buffer. We're hitting the

              Status = AdjustCursorPosition(screenInfo, CursorPosition, WI_IsFlagSet(dwFlags, WC_KEEP_CURSOR_VISIBLE), psScrollY);

call in _stream.cpp:560.

The cursor is currently at {40, 29}, the start of the run of text that wrapped. We're trying to adjust it to {0, 30}, which would be the start of the next line of the buffer. However, the buffer is only 30 lines tall, so we've got to IncrementCircularBuffer first, so we can move the cursor there.

When that happens, we're going to paint frame. At the end of that frame, we're going to try and paint the cursor position. The cursor is still at {40, 29} here, so unfortunately, the cursorIsInDeferredWrap check in XtermEngine::PaintCursor is false. That means, conpty is going to try to move the cursor to where the console thinks the cursor actually is at the end of this frame, which is {40, 29}.

Now I've just got to find the right incantation to get this situation repro'd in a test

@zadjii-msft commented on GitHub (May 6, 2020): Alright, new day, new findings. I've been writing test cases all day, and I can't seem to get one that repros this case exactly. Today, I'm trying to debug through more as this happens, as opposed to psychically writing a test that repros how _I_ would implement this application's behavior. I think perhaps part of what I was getting wring in the tests is breaking the writes into multiple writes during the course of this test. Possibly also, I'm using the StateMachine to print chars to the buffer, which uses WCL with `WC_LIMIT_BACKSPACE | WC_DELAY_EOL_WRAP`, and less is definitely not using `WC_DELAY_EOL_WRAP` here. They're only using `WC_LIMIT_BACKSPACE` (0x10). When this happens, `less` is writing some text that's longer than the width of the buffer to the last line of the buffer. We're hitting the ```c++ Status = AdjustCursorPosition(screenInfo, CursorPosition, WI_IsFlagSet(dwFlags, WC_KEEP_CURSOR_VISIBLE), psScrollY); ``` call in `_stream.cpp:560`. The cursor is _currently_ at `{40, 29}`, the _start_ of the run of text that wrapped. We're trying to adjust it to `{0, 30}`, which would be the start of the next line of the buffer. However, the buffer is only 30 lines tall, so we've got to `IncrementCircularBuffer` first, so we can move the cursor there. When that happens, we're going to paint frame. At the end of that frame, we're going to try and paint the cursor position. The cursor is still at `{40, 29}` here, so unfortunately, the `cursorIsInDeferredWrap` check in `XtermEngine::PaintCursor` is `false`. That means, conpty is going to try to move the cursor to where the console thinks the cursor actually is at the end of this frame, which is `{40, 29}`. Now I've just got to find the right incantation to get this situation repro'd in a test
Author
Owner

@ghost commented on GitHub (May 13, 2020):

:tada:This issue was addressed in #5771, which has now been successfully released as Windows Terminal Release Candidate v0.11.1333.0 (1.0rc2).🎉

Handy links:

@ghost commented on GitHub (May 13, 2020): :tada:This issue was addressed in #5771, which has now been successfully released as `Windows Terminal Release Candidate v0.11.1333.0 (1.0rc2)`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.11.1333.0 (1.0rc2)) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7864