wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.81k stars 798 forks source link

starship git status icon (arrow up, arrow down) not rendering properly #5119

Open FabianRig opened 8 months ago

FabianRig commented 8 months ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

Gnome

WezTerm version

20240203-110809-546fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

Running on NixOS unstable.

Starship shows the git repo status in its prompt.

When the local repo is behind or ahead, an arrow is shown inside squared brackets. This arrow doesn't render correctly. However, if you copy/paste the missing symbol from the starship line to the prompt, it renders correctly.

(The arrow also renders correctly in both "Console" and "Kitty".

To Reproduce

The same happens without a config, e.g. "wezterm -n". Console and Kitty work fine.

Configuration

no config

Expected Behavior

Render up and down arrows correctly inside the squared brackets of starship.

Logs

No response

Anything else?

No response

FabianRig commented 8 months ago

Perhaps this helps?

grafik

bew commented 8 months ago

I'd suggest making a recording of what exactly is starship sending to the terminal using wezterm record and share that recording here 🙏

jankatins commented 8 months ago

One guess: the starship line is bold red and the prompt is normal, so I would guess that's a difference which might explain the different rendering. What does wezterm ls-fonts itself say, e.g. is there a difference between the normal version and the other ones?

(is there a way to make wezterm ls-fonts --text use bold?)

FabianRig commented 8 months ago

I've attached the recording (that's awesome, btw!) as well as the ls-fonts output. Perhaps you can spot something in there?!

ls-fonts.txt wezterm-recording-7vPTNM.cast.txt

Unicode 21e3 (that kind of arrow) doesn't seem to work. As a workaround I can use other arrows which are part of the nerd font. However, it would still be nice to find out what the problem is...

kouyk commented 8 months ago

I'm experiencing a similar issue as well on NixOS unstable, narrowing it down to the difference between the character being emitted by the prompt/shell vs stdout from other programs.

For a minimum reproducible example, add ⇣⇡ somewhere in the shell prompt. Open a new window and find that those characters do not display correctly. Then save those two characters in a text file. Open another window, cat the file you have just saved. If you watch carefully, those characters will display as boxes at first, before rendering correctly after a split second. Now even the arrows in the prompt will be rendered correctly.

wez commented 8 months ago

Neither the Fixed font nor FiraCode Nerd Font Mono is part of the default wezterm config, but in the OP you claim that you have no config, so something about this report doesn't add up. If you truly have no wezterm config, how did you install wezterm? Is the nix flavor of wezterm not including the normal wezterm default font configuration? Do you have an unusual fontconfig setup?

FabianRig commented 8 months ago

Hi, thanks for your answer!

Sorry for being imprecise! I do have a config and the ls-fonts is with the config. However, the same problem happens if I start wezterm using "wezterm -n" -- which from my understanding is without a config?

I don't have access to the machine atm, so I can't provide my current config nor the ls-fonts from wezterm -n.

kouyk commented 8 months ago

Is the nix flavor of wezterm not including the normal wezterm default font configuration?

I can confirm that the nix packaged version of wezterm includes the default font configuration, both by observing the fallback fonts running without a config as well as looking at the nix derivation.

FWIW I ran a bisect against nixpkgs, nixos/nixpkgs@700cec9bceb81db78b085be65a6394a5004b4ccd is where the behaviour changed. The referenced commit updated from 20230712-072601-f4abf8fd to the 20240127-113634-bbcac864 release. During the process, both the nixos system configuration and wezterm configuration remained the same, ls-fonts resolves to the same font path in the nix store each time. Is this sufficient to rule out the issue with fontconfig?

jankatins commented 8 months ago

Just FYI: I have a similar observation on mac: I do not configure any fonts and wezterm ls-fontsonly shows the built-in ones, but running wezterm ls-fonts --text ⇕ tells me it uses Menlo for displaying that symbol:

λ  wezterm ls-fonts --text ⇕
LeftToRight
 0 ⇕    \u{21d5}     x_adv=8  cells=1  glyph=uni21D5,1924 wezterm.font("Menlo", {weight="Regular", stretch="Normal", style="Normal"})
                                      /System/Library/Fonts/Menlo.ttc, CoreText
Full wezterm ls-fonts output ```shell λ wezterm ls-fonts Primary font: wezterm.font_with_fallback({ -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) When Intensity=Half Italic=true: wezterm.font_with_fallback({ -- , BuiltIn -- AKA: "JetBrains Mono ExtraLight" {family="JetBrains Mono", weight="ExtraLight", style="Italic"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) When Intensity=Half Italic=false: wezterm.font_with_fallback({ -- , BuiltIn {family="JetBrains Mono", weight="ExtraLight"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) When Intensity=Bold Italic=false: wezterm.font_with_fallback({ -- , BuiltIn {family="JetBrains Mono", weight="DemiBold"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) When Intensity=Bold Italic=true: wezterm.font_with_fallback({ -- , BuiltIn -- AKA: "JetBrains Mono SemiBold" {family="JetBrains Mono", weight="DemiBold", style="Italic"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) When Intensity=Normal Italic=true: wezterm.font_with_fallback({ -- , BuiltIn {family="JetBrains Mono", style="Italic"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) Title font: wezterm.font_with_fallback({ -- , BuiltIn {family="Roboto", weight="Bold"}, -- , BuiltIn "JetBrains Mono", -- , BuiltIn -- Assumed to have Emoji Presentation "Noto Color Emoji", -- , BuiltIn "Symbols Nerd Font Mono", }) ```
wez commented 8 months ago

First, it's worth noting that most fonts do not contain every possible glyph.

On all operating systems, if wezterm cannot find a glyph in the list of configured fonts, it will attempt to ask the system which font has it, using an OS-specific fallback. As a result it is expected to sometimes see fonts show up in wezterm ls-fonts --text output which are not explicitly listed in the wezterm config.

What I'd like to nail down here is:

FabianRig commented 8 months ago

Hi wez!

Attached you find files for the following:

Perhaps I wasn't precise: The missing glyph problem in the starship line is both present in a terminal with my config as well as in a terminal which I start with wezterm -n (without a config).

Best regards and thank you for trying to solve this!

fonts-with-21e3.txt fonts-with-21e3-v.txt ls-fonts.txt ls-fonts-n.txt wezterm.lua.txt