Wrap double-height text properly #20208

Open
opened 2026-01-31 07:06:34 +00:00 by claunia · 9 comments
Owner

Originally created by @ClaireCJS on GitHub (Jul 9, 2023).

Windows Terminal version

No response

Windows build number

No response

Other Software

No response

Steps to reproduce

Create double-height text and then use it to write a line longer than the width of the current console window/pane

Expected Behavior

that it would wrap into another double-height line

Actual Behavior

It actually breaks the double-height line into two and ruins the effect, and then wraps the remainder twice as single height lines

image

Perhaps the wrapped text of a "big" line can be buffered and if it matches the wrapped text of the next line and that line is also "big", then a new "big" line can be created with the wrapped text and inserted after?

Originally created by @ClaireCJS on GitHub (Jul 9, 2023). ### Windows Terminal version _No response_ ### Windows build number _No response_ ### Other Software _No response_ ### Steps to reproduce Create double-height text and then use it to write a line longer than the width of the current console window/pane ### Expected Behavior that it would wrap into another double-height line ### Actual Behavior It actually breaks the double-height line into two and ruins the effect, and then wraps the remainder twice as single height lines ![image](https://github.com/microsoft/terminal/assets/789591/93c6b66b-0857-4f94-aff8-12d975e7c0ac) Perhaps the wrapped text of a "big" line can be buffered and if it matches the wrapped text of the next line and that line is also "big", then a new "big" line can be created with the wrapped text and inserted after?
claunia added the Help WantedProduct-ConhostArea-OutputIssue-Task labels 2026-01-31 07:06:34 +00:00
Author
Owner

@ClaireCJS commented on GitHub (Jul 9, 2023):

Here's another more carefully constructed example, and a rendition of what in my opinion I think should have happened:

image

@ClaireCJS commented on GitHub (Jul 9, 2023): Here's another more carefully constructed example, and a rendition of what in my opinion I think should have happened: ![image](https://github.com/microsoft/terminal/assets/789591/8e76688f-c854-4864-a76a-42f9ace23f8d)
Author
Owner

@j4james commented on GitHub (Jul 9, 2023):

Perhaps the wrapped text of a "big" line can be buffered and if it matches the wrapped text of the next line and that line is also "big", then a new "big" line can be created with the wrapped text and inserted after?

Yeah. this is something I had hoped we might be able to do one day. I don't think it even matters if the lines don't match. As long as you've got a top and bottom double-height pair, I think that should be enough to trigger a combined wrap.

That said, there are a bunch of edge cases which will likely make this more complicated than it seems at first glance. So as an interim solution we might want to consider just truncating any double height lines when they're resized. That at least would be a visual improvement, although the downside is that you're losing content in the process.

@j4james commented on GitHub (Jul 9, 2023): > Perhaps the wrapped text of a "big" line can be buffered and if it matches the wrapped text of the next line and that line is also "big", then a new "big" line can be created with the wrapped text and inserted after? Yeah. this is something I had hoped we might be able to do one day. I don't think it even matters if the lines don't match. As long as you've got a top and bottom double-height pair, I think that should be enough to trigger a combined wrap. That said, there are a bunch of edge cases which will likely make this more complicated than it seems at first glance. So as an interim solution we might want to consider just truncating any double height lines when they're resized. That at least would be a visual improvement, although the downside is that you're losing content in the process.
Author
Owner

@ClaireCJS commented on GitHub (Jul 9, 2023):

I guess under-the-hood it's more complicated than "just store what you truncate and later spit it out" :)

You're right, it shouldn't matter if the lines match. If someone wants mismatched lines, that's their prerogative. There's some neat/funny things that can be done with that.

image

@ClaireCJS commented on GitHub (Jul 9, 2023): I guess under-the-hood it's more complicated than "just store what you truncate and later spit it out" :) You're right, it shouldn't matter if the lines match. If someone wants mismatched lines, that's their prerogative. There's some neat/funny things that can be done with that. ![image](https://github.com/microsoft/terminal/assets/789591/a101a154-b270-403f-82ec-1149cbca79ca)
Author
Owner

@j4james commented on GitHub (Jul 10, 2023):

Just to be clear here, when you're referring to the text wrapping, do you mean when an application outputs text that doesn't fit on one line? Or are you talking about text that was originally on one line, but was later forced to wrap by the terminal when the window was resized?

I assumed the latter, because window resizing is the terminal's responsibility. However, if you actually meant the former, then that's up to the application to handle correctly. If you've got double height text that isn't expected to fit on a single line, it's the app's responsibility to split that in two, and write out the two instances of each half with appropriate line renditions.

@j4james commented on GitHub (Jul 10, 2023): Just to be clear here, when you're referring to the text wrapping, do you mean when an application outputs text that doesn't fit on one line? Or are you talking about text that was originally on one line, but was later forced to wrap by the terminal when the window was resized? I assumed the latter, because window resizing is the terminal's responsibility. However, if you actually meant the former, then that's up to the application to handle correctly. If you've got double height text that isn't expected to fit on a single line, it's the app's responsibility to split that in two, and write out the two instances of each half with appropriate line renditions.
Author
Owner

@ClaireCJS commented on GitHub (Jul 10, 2023):

Yea i meant the first.

That seems weird that it's the app's responsibility to handle line-wrapping. I don't think most command lines actually support the double height text, it's just something windows terminal is making possible. So they're not aware of it to do anything with it. Probably the case here, too.

@ClaireCJS commented on GitHub (Jul 10, 2023): Yea i meant the first. That seems weird that it's the app's responsibility to handle line-wrapping. I don't think most command lines actually support the double height text, it's just something windows terminal is making possible. So they're not aware of it to do anything with it. Probably the case here, too.
Author
Owner

@j4james commented on GitHub (Jul 11, 2023):

It's not like this is something unique to Windows Terminal though. This is a standard level 1 VT capability that has existed for decades. We're just following the standard.

And typically these attributes would be used for things like headings, which wouldn't be expected to wrap. Although it's not particularly difficult for an application to manually wrap double-height text if they really wanted to.

@j4james commented on GitHub (Jul 11, 2023): It's not like this is something unique to Windows Terminal though. This is a standard level 1 VT capability that has existed for decades. We're just following the standard. And typically these attributes would be used for things like headings, which wouldn't be expected to wrap. Although it's not particularly difficult for an application to manually wrap double-height text if they really wanted to.
Author
Owner

@lhecker commented on GitHub (Jul 12, 2023):

I really liked the "truncation" hot-fix so I implemented it in #15701. I'm personally not intending to implement better alternatives (like wrapping double height rows in pairs).

@lhecker commented on GitHub (Jul 12, 2023): I really liked the "truncation" hot-fix so I implemented it in #15701. I'm personally not intending to implement better alternatives (like wrapping double height rows in pairs).
Author
Owner

@ClaireCJS commented on GitHub (Jul 12, 2023):

I really liked the "truncation" hot-fix so I implemented it in #15701. I'm personally not intending to implement better alternatives (like wrapping double height rows in pairs).

Amy chance we could just truncate the 1st of the two? that way the 2nd one can still line-wrap to normal size and no output is lost, but the double-height visual isn't perturbed either.

Basically just, don't truncate a line if the last one was?

@ClaireCJS commented on GitHub (Jul 12, 2023): > I really liked the "truncation" hot-fix so I implemented it in #15701. I'm personally not intending to implement better alternatives (like wrapping double height rows in pairs). Amy chance we could just truncate the 1st of the two? that way the 2nd one can still line-wrap to normal size and no output is lost, but the double-height visual isn't perturbed either. Basically just, don't truncate a line if the last one was?
Author
Owner

@ClaireCJS commented on GitHub (Nov 26, 2024):

Hi!

As a follow-up, and possibly the same or a different bug, I wanted to illustrate some weirdness that may or may not relate to this:

Something is happening prematurely. This isn't even really a wrap bug. Somehow, getting within ≈7 (but not always 7?) characters of the right of the screen inserts a blank line that shouldn't be there.

The more I think about this, the more I think this isn't a wrapping situation, so I think this is actually a separate bug that I should file, so I'm going to paste this into a new bug report.

rem Adjust terminal width to 209 columns first...
pause

set big_bot=←#4
set big_top=←#3
set message=there are 209 columns...there are 209 columns...there are 209 columns...there are 209 columns....
rem length of message is 97
echo %message%

echo -----------
echo %big_top%%message% 
echo %big_bot%%message%
echo -----------

rem This message is one character shorter:
set message=there are 209 columns...there are 209 columns...there are 209 columns...there are 209 columns...

echo -----------
echo %big_top%%message% 
echo %big_bot%%message%
echo -----------


Image

^ I can't think of a conceivable reason in existence for this blank line to start appearing when you get ~7 from the right like that

@ClaireCJS commented on GitHub (Nov 26, 2024): Hi! As a follow-up, and possibly the same or a different bug, I wanted to illustrate some weirdness that may or may not relate to this: Something is happening prematurely. This isn't even really a wrap bug. Somehow, getting within ≈7 (but not always 7?) characters of the right of the screen inserts a blank line that shouldn't be there. The more I think about this, the more I think this isn't a wrapping situation, so I think this is actually a separate bug that I should file, so I'm going to paste this into a new bug report. ``` rem Adjust terminal width to 209 columns first... pause set big_bot=←#4 set big_top=←#3 set message=there are 209 columns...there are 209 columns...there are 209 columns...there are 209 columns.... rem length of message is 97 echo %message% echo ----------- echo %big_top%%message% echo %big_bot%%message% echo ----------- rem This message is one character shorter: set message=there are 209 columns...there are 209 columns...there are 209 columns...there are 209 columns... echo ----------- echo %big_top%%message% echo %big_bot%%message% echo ----------- ``` ![Image](https://github.com/user-attachments/assets/0bd6aac8-1fe8-4dfe-b0fa-75568aea3944) ^ I can't think of a conceivable reason in existence for this blank line to start appearing when you get ~7 from the right like that
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20208