Double check how we reflow for a huge height delta #20548

Open
opened 2026-01-31 07:17:14 +00:00 by claunia · 0 comments
Owner

Originally created by @zadjii-msft on GitHub (Sep 26, 2023).

Yes, exactly that. I did it for this test specifically:
fc4a37ee91/src/buffer/out/ut_textbuffer/ReflowTests.cpp (L294-L315)

$ is the cursor. false in each line means that it has an explicit newline (true = force wrap).
It has a lot of comments about bugs in the old implementation, which is why the entire text past the cursor fits into the new buffer. In the new, fixed implementation the false = explicit newlines are correctly handled and so it doesn't fit anymore:
6374aece11/src/buffer/out/ut_textbuffer/ReflowTests.cpp (L294-L315)

Basically I had to make a choice over whether I:

  • continue copying until all text in the old buffer has been consumed.
    If the new cursor position is now somewhere at a negative Y, we just put it at (0,0).
  • stop copying at some point to prevent the cursor from being lost.

I chose the latter. What do you think we should do?

Originally posted by @lhecker in https://github.com/microsoft/terminal/pull/15701#discussion_r1332947703

continue copying until all text in the old buffer has been consumed.
If the new cursor position is now somewhere at a negative Y, we just put it at (0,0).

Probably that one, right? Like, the priority should be to keep the newest text, right?

... this is currently a 1.19 candidate. I'm okay to say merge as is and iterate in the first hotfix since

  1. we're out of time and I'm about to log out for the day
  2. this is a RARE edge case
  3. this is more goodness than badness)

This is an interesting case. I'm honestly not sure how to handle it -- we should look at how other terminals that do reflow handle it?

Originally created by @zadjii-msft on GitHub (Sep 26, 2023). Yes, exactly that. I did it for this test specifically: https://github.com/microsoft/terminal/blob/fc4a37ee9189f2f7335ab942d50381a38a03acf2/src/buffer/out/ut_textbuffer/ReflowTests.cpp#L294-L315 `$` is the cursor. `false` in each line means that it has an explicit newline (`true` = force wrap). It has a lot of comments about bugs in the old implementation, which is why the entire text past the cursor fits into the new buffer. In the new, fixed implementation the `false` = explicit newlines are correctly handled and so it doesn't fit anymore: https://github.com/microsoft/terminal/blob/6374aece11edbf8b1329d56ab963e6ea2089f83d/src/buffer/out/ut_textbuffer/ReflowTests.cpp#L294-L315 Basically I had to make a choice over whether I: * continue copying until all text in the old buffer has been consumed. If the new cursor position is now somewhere at a negative Y, we just put it at (0,0). * stop copying at some point to prevent the cursor from being lost. I chose the latter. What do you think we should do? _Originally posted by @lhecker in https://github.com/microsoft/terminal/pull/15701#discussion_r1332947703_ > > continue copying until all text in the old buffer has been consumed. > > If the new cursor position is now somewhere at a negative Y, we just put it at (0,0). > > Probably that one, right? Like, the priority should be to keep the newest text, right? > > ... this is currently a 1.19 candidate. I'm okay to say merge as is and iterate in the first hotfix since > > 1. we're out of time and I'm about to log out for the day > 2. this is a RARE edge case > 3. this is more goodness than badness) > This is an interesting case. I'm honestly not sure how to handle it -- we should look at how other terminals that do reflow handle it?
claunia added the Product-ConhostArea-OutputIssue-Task labels 2026-01-31 07:17:14 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20548