Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap double-height text properly #15681

Open
ClaireCJS opened this issue Jul 9, 2023 · 9 comments
Open

Wrap double-height text properly #15681

ClaireCJS opened this issue Jul 9, 2023 · 9 comments
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase
Milestone

Comments

@ClaireCJS
Copy link

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?

@ClaireCJS ClaireCJS added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 9, 2023
@ClaireCJS
Copy link
Author

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

image

@j4james
Copy link
Collaborator

j4james commented 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.

@ClaireCJS
Copy link
Author

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

@j4james
Copy link
Collaborator

j4james commented 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.

@ClaireCJS
Copy link
Author

ClaireCJS commented 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.

@j4james
Copy link
Collaborator

j4james commented Jul 10, 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.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Area-VT Virtual Terminal sequence support labels Jul 12, 2023
@zadjii-msft zadjii-msft added this to the Backlog milestone Jul 12, 2023
@zadjii-msft zadjii-msft added Issue-Task It's a feature request, but it doesn't really need a major design. and removed Issue-Bug It either shouldn't be doing this or needs an investigation. Area-VT Virtual Terminal sequence support labels Jul 12, 2023
@PankajBhojwani PankajBhojwani added Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 12, 2023
@zadjii-msft zadjii-msft added Product-Conhost For issues in the Console codebase Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting and removed Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 12, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Jul 12, 2023
@PankajBhojwani PankajBhojwani changed the title double height text doesn't line-wrap properly Wrap double-height text properly Jul 12, 2023
@PankajBhojwani PankajBhojwani added the Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) label Jul 12, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 12, 2023
@lhecker
Copy link
Member

lhecker commented 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).

@ClaireCJS
Copy link
Author

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
Copy link
Author

ClaireCJS commented 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Conhost For issues in the Console codebase
Projects
None yet
Development

No branches or pull requests

5 participants