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

Unicode character breaks prompt #2210

Closed
thorstenkampe opened this issue Jan 26, 2021 · 8 comments
Closed

Unicode character breaks prompt #2210

thorstenkampe opened this issue Jan 26, 2021 · 8 comments
Labels
🐛 bug Something isn't working as expected.

Comments

@thorstenkampe
Copy link

Bug Report

Current Behavior

Starship prompt is right aligned by Unicode character making the prompt and the shell unusable

image

Expected Behavior

The minimal prompt should display left aligned

KDE Konsole with "bad" character:
image

KiTTY with "good" character
image

Additional context/Screenshots

  • the issue only occurs in the PuTTY family of terminal emulators (see below)
  • the issue is triggered by Unicode character U+FCB5, a "similar" character like U+F489 shows no problem
  • Oh my Posh (as an example) does not have the issue

image

Possible explanation: "bad" character U+FCB5 is "Arabic Ligature Dad with Hah Initial Form", while the "good" character is "Undefined in Unicode". Since Arabic is right to left, that might explain the issue, yet it is unclear why only the combination PuTTY with Starship shows the issue.

Environment

  • Starship version: 0.48.0
  • Shell type: Bash, Fish, PowerShell
  • Shell version: latest ones
  • Shell plugin manager: none
  • Terminal emulator: PuTTY, KiTTY, Mintty
  • Font: DejaVuSansMono NF
  • Operating system: Windows 10, Ubuntu 20.10 (connected via SSH)

Starship Configuration

format = "$env_var$character"

[env_var]
format   = ' $symbol $env_value '
# the "good" one: U+F489
#symbol   = ''
# the "bad" one: U+FCB5
symbol   = ''
variable = 'STARSHIP_SHELL'
@thorstenkampe thorstenkampe added the 🐛 bug Something isn't working as expected. label Jan 26, 2021
@mickimnet
Copy link
Member

Does Posh use the same Unicode character?

@davidkna
Copy link
Member

Possible explanation: "bad" character U+FCB5 is "Arabic Ligature Dad with Hah Initial Form", while the "good" character is "Undefined in Unicode". Since Arabic is right to left, that might explain the issue, yet it is unclear why only the combination PuTTY with Starship shows the issue.

I think that's the most likely cause of this issue.
This is ultimately caused by #2009. According to Alexays/Waybar#628 you might be able to work around your particular issue with a "unicode left-to-right mark". The issue only appearing in Putty is likely caused by different text rendering stacks.

@thorstenkampe
Copy link
Author

@mickimnet Yes, Posh and other terminals (Konsole, Conemu) use the same Unicode character.

@thorstenkampe
Copy link
Author

@davidkna How can I embed (encode) the left-to-right mark in my configuration?

@davidkna
Copy link
Member

Try \u200E

@thorstenkampe
Copy link
Author

@davidkna ...works, thanks

@mickimnet
Copy link
Member

@thorstenkampe, if it's fine with you, I would close this issue, as we already have #2009 to track the problem.

@thorstenkampe
Copy link
Author

@mickimnet yes, sure, please close the issue (plus we have an easy workaround, thanks to @davidkna )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

3 participants