Skip to content

Extra space cell inserted after unicode character #6162

Closed

Description

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.

Activity

  1. ghost added
    Needs-Triage
    on May 23, 2020
  2. ghost added
    Needs-Tag-Fix
    on May 23, 2020
  3. DHowett commented on May 23, 2020

    @DHowett
    Member

    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
    
  4. added
    Product-Conpty
    on May 23, 2020
  5. DHowett commented on May 23, 2020

    @DHowett
    Member

    (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.)

  6. j4james commented on May 24, 2020

    @j4james
    Collaborator

    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.

  7. added
    Area-Output
    Issue-Bug
    Priority-2
    on May 27, 2020
  8. ghost removed
    Needs-Tag-Fix
    on May 27, 2020
  9. added
    Help Wanted
    Product-Conhost
    and removed
    Needs-Triage
    on Jun 2, 2020
  10. lursyy commented on Dec 21, 2020

    @lursyy

    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?

  11. 2 remaining items

  12. thchr commented on Jan 5, 2022

    @thchr

    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.

  13. suasgn commented on Nov 16, 2022

    @suasgn

    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

  14. ghost added
    In-PR
    on Jan 17, 2023
  15. ghost closed this as completedin a1865b9on Jan 18, 2023
  16. ghost closed this as completedin #14640on Jan 18, 2023
  17. ghost removed
    In-PR
    on Jan 18, 2023
  18. ghost added
    Resolution-Fix-Committed
    on Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-OutputHelp WantedIssue-BugPriority-2Product-ConhostProduct-ConptyResolution-Fix-Committed

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions