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

Icons in the commits panel are broken in Console #2200

Closed
paveloom opened this issue Oct 4, 2022 · 8 comments
Closed

Icons in the commits panel are broken in Console #2200

paveloom opened this issue Oct 4, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@paveloom
Copy link

paveloom commented Oct 4, 2022

Describe the bug
This is how it looks with the JetBrains Mono Regular Nerd Font Complete in Console:

Actual 1
Actual 2

Same for Hack Regular Nerd Font Complete Mono and Fira Code Regular Nerd Font Complete Mono.

To Reproduce
Try to use any of the mentioned fonts with lazygit in Console.

Expected behavior
Should look something like this:

Expected

Version info:

lazygit --version

Tried

commit=367b0d331836c90c015bf0c45f88612f3d94d08a, build date=2022-07-20T09:27:56Z, build source=binaryRelease, version=0.35, os=linux, arch=amd64

and

commit=056cc1482168f0b7163325c1ebe20b6bcc6061ef, build date=2022-10-04T03:15:50Z, build source=unknown, version=056cc148, os=linux, arch=amd64
git --version
git version 2.37.3

Additional context
Can't reproduce in WezTerm, so it's related to Console somehow.

@paveloom paveloom added the bug Something isn't working label Oct 4, 2022
@kdu-ableton
Copy link

kdu-ableton commented Jan 11, 2023

Same here on macOS 13.0.1 using the Terminal app.

lazygit --version:

commit=, build date=, build source=homebrew, version=0.36.0, os=darwin, arch=amd64, git version=2.39.0

Screenshot 2023-01-11 at 09 40 17

@ristillu
Copy link

Same for me using GNOME Terminal 3.45.90 on Fedora 37 with Hack Nerd Font Mono.

@egmontkob
Copy link

Hi guys,

I'm a VTE developer, VTE is the terminal widget behind GNOME Console and GNOME Terminal. I would like to reproduce the issue and then locate the bug.

Could you please help me by providing step by step directions in order to reproduce the issue:

Where do you download the said font from? How do you install it exactly? How do you configure your terminal exactly to pick that font? I downloaded a JetBrains Mono font from two different places, but neither of them actually calls it "JetBrains Mono Regular Nerd Font Complete".

How do you exactly configure and start up lazygit in order to show those special symbols? I ran git clone ..., cd lazygit, go install followed by go run main.go, as seen in README.md. The app starts up, but the "Commits" window only contains the commit ID, the author's initials and the beginning of the commit log; not those special symbols about merging or whatnot.

Also: what does echo $VTE_VERSION report?

Please provide step by step instructions, unfortunately I'm not familiar with these "hacker"-type fonts, nor with lazygit, and it's not a goal currently for me to familiarize myself with them. I simply want to reproduce the issue as quickly as I can, so that I can then investigate what is happening in the terminal. Thanks!

@egmontkob
Copy link

Oh. Just noticed that someone managed to reproduce this with Terminal.app, too.

It's surely not a problem in VTE (GNOME Console, GNOME Terminal) then.

@egmontkob
Copy link

Okay, I took another attempt (after a couple of failed ones) and managed to reproduce it.

I found somewhere that I should place this in ~/.config/lazygit/config.yml:

gui:
  showIcons: true

to get those icons, indeed breaking the layout.

The characters there are U+FC16 "ARABIC LIGATURE [...]", U+FB2C "HEBREW LETTER [...]" and presumably several similar ones.

Overriding the look and the role of these characters is wrong on many levels. Any legitime text might contain them and their look would become broken. There are designated Private Use Areas in Unicode for such purposes.

But, most importantly right now: these characters have Right To Left directionality. The Unicode BiDirectional Algorithm kicks in in certain terminals, and reshuffles the cells.

As a quick workaround, in VTE BiDi treatment can be disabled by printf '\e[8l', and re-enabled by printf '\e[8h', as per the BiDi in Terminal Emulators proposal. lazygit itself could emit these on startup/exit. Other terminals probably don't support these and unconditionally apply BiDi shuffling.

The proper solution, both for fonts and apps, is to stay clear from overriding existing codepoints (especially RTL ones), and use codepoints from the Unicode Private Use Areas. For bonus points, work towards making these symbols officially part of Unicode.

@stefanhaller
Copy link
Collaborator

showIcons: true is obsolete. It instructs lazygit to use nerd fonts version 2, which is obsolete too. (I mentioned elsewhere recently that we should probably change it to default to nerd fonts version 3 instead, nowadays.)

Try

gui:
  nerdFontsVersion: "3"

instead, this should fix it (if your nerd fonts are up to date, that is).

@paveloom
Copy link
Author

  1. Download a font with additional symbols from Nerd Fonts. Install it just as any other font (the method depends on your system, on Linux it's usually done via Fontconfig). There is no Complete variant anymore, but any variant will do (try Regular). Choose the font in the Console's preferences.

  2. Configure Lazygit to use the third version of Nerd Fonts:

    # .config/lazygit/config.yml
    gui:
      nerdFontsVersion: "3"

    showIcons is deprecated.

  3. Open Lazygit while you current working directory contains a Git repository. Select the commits pane by pressing Tab/S-Tab or Left/Right, then press + a couple of times to make the pane bigger (this will show the tree of merges when appropriate).

At the time of writing, VTE_VERSION is 7401.

That said, I don't seem to be able to reproduce the issue anymore. Seems like it has been fixed when Nerd Fonts v3 came out.

@egmontkob
Copy link

@stefanhaller @paveloom Thanks for the quick response to both of you!

Indeed in pkg/gui/presentation/icons/git_icons.go the use of Arabic and Hebrew symbols seems to be conditional to Nerd Fonts v2 only.

It looks like it's indeed been fixed in Nerd Fonts v3, it uses Private codepoints. I'm happy to hear it. Also happy that we know what really caused the troubles with v2.

You may close this bug, or may decide to apply the \e[8l workaround for v2, as you see fit.

@paveloom paveloom closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants