romkatv / powerlevel10k

A Zsh theme
MIT License
46.82k stars 2.21k forks source link

Slanted style pritned incorrectly for right-aligned modules #2679

Closed Bilge closed 6 months ago

Bilge commented 6 months ago

iTerm 2 with default (recommended) font on macOS Sonoma 14.4.1.

image

evanronnei commented 6 months ago

I'm also seeing this issue. It looked fine for me prior to the most recent 3.5.0 update to iTerm2.

romkatv commented 6 months ago

I recall that iTerm2 had an option to enable built-in rendering for glyphs with powerline code-points (as opposed to using the glyphs from the font for them). I'm guessing both of you are using this option. I'm also guessing that iTerm2 in the recent update has either added a glyph used in the slanted style to their list of glyphs affected by the built-in rendering option, or changed it. In any case they must've chosen to make it occupy two columns. The font that comes with p10k is monospace, meaning that everything in it takes just one column. Consequently, when powerlevel10k instructs the terminal to draw a glyph, it assumes it'll take one column. In this case this assumption is broken (IMO what iTerm2 does is not nice).

The immediate workaround that you can use is to open ~/.p10k.zsh and edit two parameters this way:

# Separator between different-color segments on the left.
typeset -g POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0BC '
# Separator between different-color segments on the right.
typeset -g POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0BA '

Note the trailing space that I've added to the values of these parameters. You might want to do this for the two parameters above these, too.

A more practical advice, which will solve not just this issue but many others, too, and make your prompt look better, is to use Lean style.

evanronnei commented 6 months ago

The Powerline glyphs were the source of my issue, as you said. I disabled them under Settings -> Profiles -> Text -> uncheck Use built-in Powerline glyphs, which resolved the issue.

romkatv commented 6 months ago

Unfortunately, you've traded one issue for another: now powerline glyphs look worse. Try to look closely and you'll see it.

evanronnei commented 6 months ago

Oh I see it now, you're right, they don't look quite right. I found another solution (?) to the issue. I re-enabled the built-in Powerline glyphs, then under Settings -> Advanced -> Drawing -> "Draw certain Powerline symbols double-width?" -> No. This appears to resolve the issue without any adverse affects.

romkatv commented 6 months ago

Nice! That option sounds exactly like what's needed. It's unfortunate it's not the default but hey, at least it's configurable.

Bilge commented 6 months ago

Thanks @evanronnei