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

Extra space cell inserted after unicode character #6162

Closed
willmcgugan opened this issue May 23, 2020 · 7 comments · Fixed by #14640
Closed

Extra space cell inserted after unicode character #6162

willmcgugan opened this issue May 23, 2020 · 7 comments · Fixed by #14640
Assignees
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-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@willmcgugan
Copy link

Environment

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.18363.0 Microsoft Windows NT 10.0.18363.0

Terminal v1.0.1401.0

Steps to reproduce

Write the following string to the terminal (Python):

>>> print("│\x1b[33m\U0001F862\x1b[0m│")

This string is a unicode box char, followed by a foreground yellow escape, a unicode arrow, a reset escape, and another box character.

Expected behavior

The string should render three characters: a vertical line, yellow arrow, vertical line.

Actual behavior

There is an extra space after the arrow.

Screen Shot 2020-05-23 at 14 45 16

Note that this only occurs with that particular unicode character. If I replace that unicode arrow with any other character then it renders as expected.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 23, 2020
@DHowett
Copy link
Member

DHowett commented May 23, 2020

This is wild. Through-and-through, the infrastructure believes this to be a single-cell glyph. We're doing the right thing by the UCD, but then when the pseudoconsole emits it it emits it with an additional cursor move.

␛[?25h|␛[33m🡢␛[m␛[1C|␍␊
                 ^^^^
                 here

@DHowett DHowett added the Product-Conpty For console issues specifically related to conpty label May 23, 2020
@DHowett
Copy link
Member

DHowett commented May 23, 2020

(And of course, only when there's a color run break. This sound ominously related to our attribute run splitter and how it thinks the cursor moves when it splits runs.)

@j4james
Copy link
Collaborator

j4james commented May 24, 2020

I think this is actually a conhost problem - you'll see the same issue there. The conpty sequence is just trying to reproduce the state of the conhost buffer which is already incorrect.

And the color change isn't really what's triggering it - any control character will do. The state machine splits up runs of text separated by control characters. And once a run of text is written, the cursor position is moved forward the expected number of columns (which in this case is off by 1). The next run of text is then starting in the wrong position, so you get a gap.

And the reason why it's off by 1 is because the character is processed as a surrogate pair, which the WriteCharsLegacy function sees as two characters, thus moving forward two columns.

@zadjii-msft zadjii-msft 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. Priority-2 A description (P2) labels May 27, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 27, 2020
@zadjii-msft zadjii-msft added this to the 21H1 milestone May 27, 2020
@DHowett DHowett added Help Wanted We encourage anyone to jump in on these. Product-Conhost For issues in the Console codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 2, 2020
@lursyy
Copy link

lursyy commented Dec 21, 2020

I have another arrow example which I believe is related:

The robbyrussell prompt for zsh and fish uses the "➜" (U+279C) character.
It renders nicely (i.e. two characters wide) in the VS Code integrated terminal (irrespective of the font setting). Here I selected the first character for illustration:
image

In MS Terminal however, it renders as a single arrow followed by space (again, with first char selected):
image

FWIW:

  • When copying the single-character arrow from MS Terminal, I get .
  • When copying the first part of the double-character arrow (i.e. the "stem") from VS Code, I get .
  • When copying the second part of the double-character arrow (i.e. the "tip") from VS Code, I get . (Seems to be a plain old space?)

Do VS Code and MS Terminal share some of the underlying infrastructure in that regard? If so, one could take a look at how it works over there?

@DHowett DHowett mentioned this issue Jan 12, 2021
15 tasks
@zadjii-msft zadjii-msft modified the milestones: Windows vNext, 22H2 Jan 4, 2022
@thchr
Copy link

thchr commented Jan 5, 2022

There's a similar issue with the 𝑝 character (unicode U+1D45D): sometimes, a space will be inserted after 𝑝, sometimes it won't.
Similarly, even typing 𝑝 in WSL displayed on Terminal will basically garble that whole line.

@suabahasa
Copy link

I face a similar issue as described on oh-my-posh/issues#3088

image

The font I use is Caskaydia Cove Nerd Font

Oh My Posh v12.14.0

Windows Terminal - Version: 1.15.2875.0

@ghost ghost added the In-PR This issue has a related PR label Jan 17, 2023
@ghost ghost closed this as completed in a1865b9 Jan 18, 2023
@ghost ghost closed this as completed in #14640 Jan 18, 2023
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Jan 18, 2023
@ghost
Copy link

ghost commented Jan 24, 2023

🎉This issue was addressed in #14640, which has now been successfully released as Windows Terminal Preview v1.17.1023.:tada:

Handy links:

This issue was closed.
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-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Conhost For issues in the Console codebase Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants