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

OhMyPosh agnoster theme causes command to snap back on typing third character #635

Closed
hchokshi opened this issue May 9, 2019 · 4 comments
Assignees
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Milestone

Comments

@hchokshi
Copy link
Member

hchokshi commented May 9, 2019

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Windows 10 18362.30 (Enterprise)
    oh-my-posh 2.0.263 - agnoster theme
    posh-git 0.7.3
    Screenshots taken using Nerd Fonts Inconsolata NF, also tried using FuraCode NF with same results.
    I am using a build from master as of ~11am PDT today.

  • What you're doing and what's happening: (Copy & paste specific commands and their output, or include screen shots)
    Windows Terminal
    image
    Fluent Terminal (expected result)
    image
    Windows Terminal (oh-my-posh disabled, posh-git enabled)
    image

Windows Terminal with agnoster - the problematic theme
image

In this case, I typed test then backspaced the 4 characters and typed cd. The e from test is still rendered in its original position, while the other characters erased as expected.

Typing tes, the te is rendered in its original position and moved position:
image

Typing further works as expected, removing those characters from the screen:
image

  • What's wrong / what should be happening instead:
    Typing the third character should not cause the command to move its rendering (see cd ~ and Get-Command in first screenshot - first character gets covered, no issues with one or two character commands.

There is no theme with ohmyposh disabled (poshgit still enabled), or with different ohmyposh themes including the others that render those arrows. Only agnoster causes this moving to occur.

@zadjii-msft
Copy link
Member

This seems like we've got the width of the glyphs wrong. Conpty thinks the cursor advanced by one, but we're trying to render it in two cells, or vice-versa.

I coulda swore @miniksa had a fix for this somewhere...

@zadjii-msft zadjii-msft added this to the Windows Terminal v1.0 milestone May 9, 2019
@zadjii-msft zadjii-msft added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Product-Conpty For console issues specifically related to conpty Issue-Bug It either shouldn't be doing this or needs an investigation. labels May 9, 2019
@miniksa miniksa self-assigned this May 21, 2019
@miniksa
Copy link
Member

miniksa commented May 21, 2019

I didn't have a fix for this, just several internal reports of the same issue in different circumstances. I'll dig in when I get time.

@ksiazkowicz
Copy link

The easiest way to reproduce that is probably putting this in your PowerShell profile.

function prompt {
    return '✔ ';
}

Just pasting the text in quotes into Terminal makes it buggy.

@DHowett-MSFT
Copy link
Contributor

This is actually, weirdly, the same issue as #633. You wouldn't expect it, but they're two sides of the same coin.

The powerline glyphs are in a region of the character table specified as "ambiguous width." Whenever we get one of those, we ask the font how wide the grapheme cluster is. This is required to eventually support things like Devanagari and other N:M glyph->cell mapping scripts. Anyway, the standard NerdFont patcher installs the powerline glyphs as double-width glyphs.

So, Windows Terminal asks how wide the powerline characters are and gets "two cells".

There's a conhost instance backing every tab. That one also (for a long list of legacy compatibility reasons that are better explained in #1739) needs to count cells and widths and characters and stuff. That one is not using the same font, so it gets a different answer: "one cell".

They trivially and immediately disagree on where the cursor is, and where all characters after the mis-identified grapheme cluster are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

5 participants