Anki mangling whitespaces in "Enter /edit deck name" input & inconsistent deck name rendering

I mention these 2 issues together in case they’re related.

1. Anki mangles certain characters in the deck name input field

How to reproduce:

  • Click the “Add” button o on the Deck list page.
  • Type “1.[space]foo”

Expected:

  • The input renders “1. foo”

Observed:

  • The input looks like “1.[character smaller than a space]foo”

Demo:
In the following video I type 4 whitespace characters after the dot, but the first whitespace isn’t treated like the others.

Use-case for wanting to call my deck names like that: order decks by importance.

2. Deck names are rendered inconsistently
Observed:

For reference, the complete strings for the highlighted decks are:
“2. Investing” (2 spaces after the dot character)
“3. Keep fresh”
“99. Numbers”
“99. Habits (max1d)”

Expected:
Deck names are rendered the same everywhere.

Env:

  • Anki 2.1.41
  • MacOS Big Sur 11.2.2

Update (second issue): here is another screenshot for the second issue in case it helps debugging.

This time the first three deck names are:
“1. Yoga”
“2. Investing”
“3. Keep fresh”

But on the card browser list the amount of (font’s) whitespace before and after the dots looks really odd. Perhaps it’s a font kerning issue?

The deck tree on the front page is rendered by a webview, so whitespace is not preserved. For now, you can use non-breaking spaces (I think Option+Space on macOS) to get around this. As for the browser sidebar, that’s plain text. If the whitespace seems squashed, I’d blame the font rendering of your OS. I’m running Windows with a neat little program that gives me font rendering like on macOS and it looks fine.

@dae, is the HTML rendering of deck names the intended behaviour? It’s a cool feature but it feels weird that I can even put JS in them and as @juan has pointed out, it means they will be displayed differently across Anki.

1 Like

I didn’t expect people to put HTML there when this code was originally written, and future Anki versions will treat it as text.

The inconsistent spacing is likely a toolkit issue unfortunately. It doesn’t seem to happen on Qt 5.15, but 5.15 seems to break more than it fixes.

1 Like