Remove guessed_emoji_width

Just guess anew when it's not set.

(this still uses the value of $fish_emoji_width, but clamped to 1 or 2
- we could also guess if it's an unusable value, but that's a
different issue and tbh this variable is becoming less and less useful
as time moves on and things move to the new widths by default)

Fixes #8274.
This commit is contained in:
Fabian Homborg
2021-09-23 15:29:21 +02:00
parent 07e512ecd8
commit 8b093e2651
3 changed files with 9 additions and 17 deletions

View File

@@ -221,17 +221,12 @@ int killpg(int pgr, int sig) {
int g_fish_ambiguous_width = 1;
// Width of emoji characters.
int g_fish_emoji_width = 0;
// 1 is the typical emoji width in Unicode 8.
int g_guessed_fish_emoji_width = 1;
int g_fish_emoji_width = 1;
static int fish_get_emoji_width(wchar_t c) {
(void)c;
// Respect an explicit value. If we don't have one, use the guessed value. Do not try to fall
// back to wcwidth(), it's hopeless.
if (g_fish_emoji_width > 0) return g_fish_emoji_width;
return g_guessed_fish_emoji_width;
return g_fish_emoji_width;
}
// Big hack to use our versions of wcswidth where we know them to be broken, which is