jj icon indicating copy to clipboard operation
jj copied to clipboard

fix: misalignement in graphs with some fonts

Open glehmann opened this issue 6 months ago • 20 comments

by replacing ◆ (U+25C6) with ♦ (U+2666)

This should help properly rendering the jj graphs on all the systems on online documentation, instant discussion, …

Here is an screenshot example in a github comment:

image

Checklist

If applicable:

  • [ ] I have updated CHANGELOG.md
  • [ ] I have updated the documentation (README.md, docs/, demos/)
  • [ ] I have updated the config schema (cli/src/config-schema.json)
  • [ ] I have added/updated tests to cover my changes

glehmann avatar Jun 07 '25 11:06 glehmann

I'm having trouble seeing the latter symbol on Android .

Firefox

Screenshot_20250607-123003.png

Termux

Screenshot_20250607-122457.png

GitHub app

Screenshot_20250607-122836.png

ilyagr avatar Jun 07 '25 19:06 ilyagr

Oh, I've checked on linux and mac, didn't think to check on my phone. Probably not the best "fix" then

glehmann avatar Jun 07 '25 19:06 glehmann

Some (most?) unicode characters, to check how visible and well aligned they are on various systems.

◆  Black Diamond
◇  White Diamond
◈  White Diamond Containing Black Small Diamond
♢  White Diamond Suit
♦  Black Diamond Suit
❖  Black Diamond Minus White X
⟐  White Diamond With Centred Dot
⟡  White Concave-sided Diamond
⟢  White Concave-sided Diamond With Leftwards Tick
⟣  White Concave-sided Diamond With Rightwards Tick
⧰  Error-barred White Diamond
⧱  Error-barred Black Diamond
⬖  Diamond With Left Half Black
⬗  Diamond With Right Half Black
⬘  Diamond With Top Half Black
⬙  Diamond With Bottom Half Black
⬥  Black Medium Diamond
⬦  White Medium Diamond
⬩  Black Small Diamond
⯁  Black Diamond Centred
   | All the labels should be aligned on that pipe sign

glehmann avatar Jun 07 '25 19:06 glehmann

Here's Android

Termux

Screenshot_20250607-133704.png

App

Screenshot_20250607-133401.png

Firefox

Screenshot_20250607-133325.png

ilyagr avatar Jun 07 '25 20:06 ilyagr

Some (most?) unicode characters, to check how visible and well aligned they are on various systems.

◆  Black Diamond
◇  White Diamond
◈  White Diamond Containing Black Small Diamond
♢  White Diamond Suit
♦  Black Diamond Suit
❖  Black Diamond Minus White X
⟐  White Diamond With Centred Dot
⟡  White Concave-sided Diamond
⟢  White Concave-sided Diamond With Leftwards Tick
⟣  White Concave-sided Diamond With Rightwards Tick
⧰  Error-barred White Diamond
⧱  Error-barred Black Diamond
⬖  Diamond With Left Half Black
⬗  Diamond With Right Half Black
⬘  Diamond With Top Half Black
⬙  Diamond With Bottom Half Black
⬥  Black Medium Diamond
⬦  White Medium Diamond
⬩  Black Small Diamond
⯁  Black Diamond Centred
   | All the labels should be aligned on that pipe sign

windows 11, edge3:

image

thoughtpolice avatar Jun 07 '25 20:06 thoughtpolice

Some (most?) unicode characters, to check how visible and well aligned they are on various systems.

◆  Black Diamond
◇  White Diamond
◈  White Diamond Containing Black Small Diamond
♢  White Diamond Suit
♦  Black Diamond Suit
❖  Black Diamond Minus White X
⟐  White Diamond With Centred Dot
⟡  White Concave-sided Diamond
⟢  White Concave-sided Diamond With Leftwards Tick
⟣  White Concave-sided Diamond With Rightwards Tick
⧰  Error-barred White Diamond
⧱  Error-barred Black Diamond
⬖  Diamond With Left Half Black
⬗  Diamond With Right Half Black
⬘  Diamond With Top Half Black
⬙  Diamond With Bottom Half Black
⬥  Black Medium Diamond
⬦  White Medium Diamond
⬩  Black Small Diamond
⯁  Black Diamond Centred
   | All the labels should be aligned on that pipe sign

iphone 15

image

thoughtpolice avatar Jun 07 '25 20:06 thoughtpolice

Currently ♦ Black Diamond Suit seems to be the best option for the browsers, but is broken with ghostty on linux, because it falls back on a nerd font for that glyph. It works properly in the other terminals I tried so far. See https://discordapp.com/channels/968932220549103686/968932220549103689/1381009627319369831 for details.

glehmann avatar Jun 08 '25 19:06 glehmann

Confusingly, it shows up red in my email (GMail on Firefox on macOS, with whatever random fonts I have installed on top of the defaults). Seems like a bug somewhere. This does not happen for ♦ in GitHub on Firefox on macOS. If this is the only issue, it might not be a big deal.

image

The original U+2BC1 does even worse for Firefox on macOS, BTW (GMail or GitHub). The other symbols do fine, though.

image

Full list as shown by Gmail, for reference:

image
Probably less relevant examples with Ghostty and various configs

Perhaps the red symbol is similar to what you saw with ~~Kitty~~ Ghostty (Update: I originally typed Kitty, but I always meant Ghostty). On macOS, ~~Kitty~~ Ghostty does fine:

image

Or, with my config

font-family=""
font-family="JetBrains Mono"
font-family="Symbols Nerd Font Mono"

I get the similar-but-not-quite-the-same (worse aligned):

image

I don't remember why I wanted this config; I think there was some symbol that wasn't shown without it.

Here's the diff (in red):

image

Update: After mistakenly saying "Kitty" above, I tried it in actual Kitty, and the result is quite different from Ghostty. Initially, Kitty looked much better to me, but maybe it's only because of the way the list was ordered. In any case, here's 🐈 on macOS:

image

ilyagr avatar Jun 08 '25 19:06 ilyagr

Here's before and after for me with FiraCode Nerd Font Mono: Screenshot 2025-06-15 at 06 02 31 Screenshot 2025-06-15 at 06 04 17

I think it looks less aligned with the new symbol. It's also harder to tell that it's a diamond because it's smaller.

martinvonz avatar Jun 14 '25 22:06 martinvonz

I think it looks less aligned with the new symbol. It's also harder to tell that it's a diamond because it's smaller.

It looks worse after, but it doesn't look well-aligned before either. Which terminal do you use?

glehmann avatar Jun 15 '25 15:06 glehmann

iTerm2

martinvonz avatar Jun 15 '25 21:06 martinvonz

collecting how it's displayed by various terminals.

Each line is with the current symbol◆ (U+25C6) / the proposed one ♦ (U+2666)

Linux

Alacritty

image image

Gnome terminal

image image

Ghostty

image image

Jetbrains (PyCharm)

image image

Kitty

image image

Konsole

image image

LXTerminal

image image

Visual Studio Code

image image

macOS

Ghostty

image image

iTerm2

image image

Jetbrains (PyCharm)

image image

Terminal

image image

Visual Studio Code

image image

WezTerm

image image

Warp

image image

Windows

Alacritty

image image

Tabby

image image

Terminal

image image

Visual Studio Code

image image

glehmann avatar Jun 16 '25 15:06 glehmann

I tried to make a comprehensive overview of the most common terminals that I know. I'm really not a windows guy, so I may have missed an important one. Please complete the screenshot collection if you think that's the case!

Overall, I'm surprised by the number of configurations that appear misaligned with the current symbol. The new proposal, though not perfect, shows a significant global improvement across the tested configurations.

glehmann avatar Jun 16 '25 20:06 glehmann

Is there an objection to that change? As shown by the collected screenshots, the display is significantly better in the terminals and in the web browsers, yet not perfect in all the terminals.

IMO it would be interesting to merge that commit shortly after a release and gather feedback from the community.

glehmann avatar Jun 22 '25 21:06 glehmann

(I don't use unicode node symbols, so I personally don't have opinion, but ...)

As shown by the collected screenshots, the display is significantly better in the terminals and in the web browsers, yet not perfect in all the terminals.

Is it strictly better? A bigger emoji might be easier to spot than well-aligned tiny symbol.

yuja avatar Jun 23 '25 11:06 yuja

Is it strictly better? A bigger emoji might be easier to spot than well-aligned tiny symbol.

Indeed, that's a drawback I forgot to mention — because it's a minor one for me — while I should have. The new symbol is not exactly tiny either and is very different from the others, as visible in the screenshots.

That lets us with:

  • a much better alignment in web browsers, instant messaging applications, …
  • a better alignment in some of the most-used terminals

but

  • a worse alignment in a few terminals
  • a smaller symbol, which could impact visibility

While not a perfect solution, I believe the trade-off is worthwhile. I'm keen to hear others' thoughts.

glehmann avatar Jun 23 '25 15:06 glehmann

Isn't it a diamond because it was copied from some other VCS? If so, copy the character they used also. If not, use a different symbol ?

joyously avatar Jun 23 '25 16:06 joyously

Isn't it a diamond because it was copied from some other VCS? If so, copy the character they used also. If not, use a different symbol ?

I think it was copied from git-branchless because a diamond serves as a good visual metaphor for immutability. I like it, I'm just not very pleased with how it's displayed in various contexts, which is why I'm looking for an alternative diamond glyph.

glehmann avatar Jun 23 '25 20:06 glehmann

I'm also on the fence. It just so happens that the new symbol looks worse on some of the terminals I use (Termux and Android in general, Kitty), and it looks weird in GMail. So, while I wouldn't oppose this change (I don't think these problems are particularly severe), I'm not enthusiastic about it either.

ilyagr avatar Jun 23 '25 22:06 ilyagr

the new symbol looks worse on some of the terminals I use (Termux and Android in general, Kitty)

worse because it is slightly smaller?

glehmann avatar Jun 24 '25 13:06 glehmann

the new symbol looks worse on some of the terminals I use (Termux and Android in general, Kitty)

worse because it is slightly smaller?

Sorry, I meant Ghostty. I keep mixing them up. I was thinking of the first Ghostty screenshot from https://github.com/jj-vcs/jj/pull/6708#issuecomment-2977194201, though it doesn't actually affect me because I use Ghostty on a Mac. I know you filed an issue about that; I think and hope that Ghostty's treatment of such issues hasn't been finalized yet and will change.

For Android, I meant https://github.com/jj-vcs/jj/pull/6708#issuecomment-2952989385.

ilyagr avatar Jul 01 '25 20:07 ilyagr

I'm slightly against it, but mostly for selfish reasons (it will make things uglier for me on iTerm2). Maybe the root cause of the alignment problems is that the diamond symbol is not meant for drawing. Maybe there's something else we can find that's meant for graph drawing.

martinvonz avatar Jul 02 '25 02:07 martinvonz