-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Terminal can omit backgrounds, links and underlines on empty cells #13229
Comments
Hmm. I'm betting we didn't account for hyperlinks in that optimization. Either in https://github.com/microsoft/terminal/blob/main/src/renderer/vt/paint.cpp#L376, or up in Renderer itself. |
This probably happens when we decide to use terminal/src/renderer/vt/paint.cpp Lines 412 to 421 in 4e20a86
However, I don't think we changed this behavior in Preview 1.14... Thank the gods it's not because of the optimization I added, HOWEVER, It would probably be fixed if we DID use terminal/src/renderer/vt/paint.cpp Line 437 in 4e20a86
Proving once again that having multiple copies of the same code is deleterious to one's health. |
Hmmmmm. What about 1.13? |
I got the 1.13.11432.0 RTW in the meantime, and it doesn't trim the spaces. |
Okay so
what the devil in 1.14 could have broken this? |
The diffs to |
Found the culprit. f4e0d9f |
OK. So this is a wider problem than just hyperlinks. You can see the same issue with something like the reverse attribute.
Both the spaces before and after the Bottom line is that conpty shouldn't be expecting any of the VT erase operations to write out attributes other than color. This was probably already a problem in other conpty terminals which implement the erase operations correctly. |
I wonder, should we simply revisit the ECH/CUF space eliding optimization? Thanks for digging into this, James 😄 |
You know, this makes sense. I did the ECH optimization before #3100, which fixed ECH for conhost.
I don't think that's a bad idea. I think the worst case of the spaces was "spaces at the end of the line", but I don't think we ECH&CUF for that anyways. We may want to do that for 1.14 Stable, if we can do it safely in the next week. |
Right, for excess spaces at the end of the line I think we use |
Yeah. Here's a failing test case for
This writes out a full line of spaces with the reverse attribute set, and conpty translates that to an |
The more I think about it, the closer the resolutions for this bug and #8341 look to eachother. At the end of the day, both are about not printing "meaningful" spaces, where "meaningful" is defined roughly as "spaces that differ from the clear state for new lines or empty buffers." I had a WIP for #8341 going, I should dig it up. |
Well this is hairy now ain't it.
I'll need to noodle more (probably next week) |
It just occurred to me that we may be worrying unnecessarily about the implications of just writing out the spaces. Is it really any different from a line filled with some other character which we wouldn't have been able to optimise? It's not like those spaces could have come from something like an erase screen operation - someone must have actively written out a space in those locations in order for us to get these attributes. So the idea wouldn't be to turn off the ECH/EL optimisations completely - just turn them off if the spaces are using any of the unsupported attributes. The only edge case I can think of would possibly be from one of the legacy console APIs that can fill parts of the buffer with attributes like underline and reverse without necessarily writing to those locations. But again I don't think that would be any different from filling the screen with a non-space character, which I think you can also do with the console APIs. Anyway, it's just a thought, in case you don't have any better ideas. |
Shit @j4james I think you and I came to the same idea at the same time. I'm pushing out a PR now 😉 |
... which should have never worked in the first place Quick filing a PR for review. This is the bulk of the actual code changes. Figured it was best to review the conpty changes sooner than later and I can add tests in the morning. Test cases: ``` printf "\e[7m test \e[m\n" ``` ``` printf "\e[7m"; printf ' %.0s' $(seq 1 $COLUMNS); printf "\e[m\n" ``` After: ![image](https://user-images.githubusercontent.com/18356694/182478185-6e65ab99-5c27-4772-af3b-2baa22387ec1.png) Closes #13229 Definitely fixes: * [x] #13643 * [x] PowerShell/PowerShell#17812
... which should have never worked in the first place Quick filing a PR for review. This is the bulk of the actual code changes. Figured it was best to review the conpty changes sooner than later and I can add tests in the morning. Test cases: ``` printf "\e[7m test \e[m\n" ``` ``` printf "\e[7m"; printf ' %.0s' $(seq 1 $COLUMNS); printf "\e[m\n" ``` After: ![image](https://user-images.githubusercontent.com/18356694/182478185-6e65ab99-5c27-4772-af3b-2baa22387ec1.png) Closes #13229 Definitely fixes: * [x] #13643 * [x] PowerShell/PowerShell#17812 (cherry picked from commit ffe9a0f) Service-Card-Id: 84736231 Service-Version: 1.15
🎉This issue was addressed in #13661, which has now been successfully released as Handy links: |
🎉This issue was addressed in #13661, which has now been successfully released as Handy links: |
... which should have never worked in the first place Quick filing a PR for review. This is the bulk of the actual code changes. Figured it was best to review the conpty changes sooner than later and I can add tests in the morning. Test cases: ``` printf "\e[7m test \e[m\n" ``` ``` printf "\e[7m"; printf ' %.0s' $(seq 1 $COLUMNS); printf "\e[m\n" ``` After: ![image](https://user-images.githubusercontent.com/18356694/182478185-6e65ab99-5c27-4772-af3b-2baa22387ec1.png) Closes microsoft#13229 Definitely fixes: * [x] microsoft#13643 * [x] PowerShell/PowerShell#17812 (cherry picked from commit ffe9a0f) Service-Card-Id: 84736231 Service-Version: 1.15 (cherry picked from commit fff3372) Service-Card-Id: 84736230 Service-Version: 1.14
Original Title: Hyperlink on spaces over-optimization breaks rendering and usability
Windows Terminal version
1.14.1452.0
Windows build number
10.0.22000.708
Other Software
My ActiveScript Shell, just to use JScript to easily script the console, but problem is with VT optimization.
Steps to reproduce
When a hyperlink contains trailing spaces, they are shown or trimmed depending on the number of trailing spaces.
Starting at 9 spaces or more, they get used as spacing, but are not considered part of the hyperlink, while 8 or less are properly rendered and clickable as part of the hyperlink.
Expected Behavior
Hyperlinks extending on space characters can be a design decision for consistency and usability, the Terminal should not decide to shorten the number of columns the hyperlink is effectively available on.
Note non-preview build 1.12.10983.0 does not trim the spaces, so this is a new bug introduced in the Preview version 1.14.1452.0.
Actual Behavior
Current Preview build seems over-agressive in optimizing the spaces, and swallows spaces without abiding by the original VT output of apps.
See how the spaces above the red underlines are different between 8 and 9 spaces.
The text was updated successfully, but these errors were encountered: