You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unicode support broken (was This ⸻ unicode ⸻ character ⸻ makes ⸻ weird ⸻ things ⸻ happen) #2652
I don't experience the same thing, but instead the color of the dash gets all weird, guess it is due to the overlapping. I don't see any repetition of other characters.
This failure mode is when fish's idea of where the cursor is gets out of sync with where it actually is. This can come about if fish thinks a character is single width but it's actually double width, or vice versa.
There are two things you can do to contain the effect of the disparity between wcwidth and the actual terminal: 1) turn off autowrap whenever the editor is in control (echo '\033[?7l' to turn off, '\033[?7h' to turn on) and insert returns explicitly; 2) always re-render whole lines, from left to right, when the buffer changes. This way the line number is always correct and you minimize your dependency on the column number.
I can't reproduce the problem using iTerm2 on OS X without a font installed that supports that character. So I see the single width undefined char glyph. Is it possible a recent change (such as the one I made to support the C locale better) has "fixed" this? Can anyone reproduce this problem using a fish built from git head? If so can you provide better directions for reproducing the problem than was in the original comment?
Less common are the two-em dash (⸺) and three-em dash (⸻), both added to Unicode with version 6.1 as U+2E3A and U+2E3B.
So our fish_wcwidth() implementation is out of date.
P.S., It isn't just that character which renders weirdly. The Symbola font is ugly --- at least as handled by OS X Terminal.app. The inter-char spacing is just awful; even for plain ASCII chars.
It shouldn't be necessary to actually select Symbola as your font. Just install it and it will be used for odds and ends (like ⸻) with a regular terminal font selected.
For me this font+character does the same thing as the double-width emojis in the just-closed #750 -- just a bigger difference in width with this example.
FWIW, fish_wcwidth() returns 1 and the OS X El Capitan (10.11.6) wcwidth() returns -1.
For me this font+character does the same thing as the double-width emojis in the just-closed #750
That's weird because on my system that emoji renders as a single-width char in both Terminal.app (where I explicitly made Symbola the primary font) and iTerm2 using Consolas. However, in both of those multiple instances of that char overlap each other. So it's pretty clear it should be treated as double-width but fish and my terminals are treating it as single-width.
@spacekookie emoji widths seem to be working pretty well on fish master (which includes a new wcwidth per #5081) with kitty terminal. You'll want to set emoji width to 2:
`set -g fish_emoji_width 2`
Please give it a try and report back! Really appreciate your patience with this.
so always when setting up fish we need to remember to set the variable to get emojis to work?
Maybe. That's the point of the variable existing - some terminals/systems need it set to 2 and some to 1. In particular, you'll have to set it to 2 if your terminal is using the Unicode 9 widths, and to 1 otherwise - which means even with e.g. iTerm2, it depends on that option you talked about! Which means we can't do terminal detection via $TERM and friends like we do for e.g. cursor shape or truecolor support.
Doesn't seem very "user friendly"..
Unfortunately, there's nothing fantastic we can do, simply because there is no way for us to communicate with the terminal to figure out what width it uses. The variable is very much an admission of that fact.
It might be better to swap the default around - currently if you don't set that variable, we're using the pre-9 widths. Maybe it might be better to use the post-9 ones, or maybe we should wait another year or so until operating systems have caught up?
Yeah these variables are super-lame, but there's no other option. The best we can hope for is excellent defaults (can still improve here) and fallback configurability.
I would guess the variable has the correct default sense today but could easily be wrong. Importantly though it only affects emoji that are in Unicode 8 or earlier (surprisingly few!). Emoji introduced in Unicode 9+ are always assumed to render per Unicode 9 widths.
The best idea I can come up with would be to have an interactive function where the user is presented with a unicode character displayed with the two different settings and can select which one looks best, that would then automatically set and persisted as the fish_emoji_width. Would that be possible?
I would guess the variable has the correct default sense today but could easily be wrong.
So, glibc got updated in 2.26, which was released on 2017-08-02, so about a year ago. For Ubuntu, that means everything after 17.10 does Unicode 9.
Notably, that leaves Ubuntu 16.04 (which is still supported and the current basis for WSL) and current Debian Stable out. I suspect other distributions to work the same, and I don't know how this works on macOS.
So that's basically a worst-case answer. Large parts of our user base are using older distributions, especially on servers, so I can't be sure that switching defaults will make it work for more users.
Alternatively we could do version-detection of the C library, but that might be too confusing given that there's often two knobs to deal with (the terminal's and ours) and keep in sync.
The best idea I can come up with would be to have an interactive function where the user is presented with a unicode character displayed with the two different settings and can select which one looks best
When is this shown? Does the user explicitly execute it? Is it a first-launch "wizard"?
Still, this might be the best idea we've seen so far. Just a simple
❤
aa
Is the heart as wide as 1 or 2 "a"?
(with the heart symbol being the last \U escape I used - no idea if that's affected by this)
When is this shown? Does the user explicitly execute it? Is it a first-launch "wizard"?
Maybe show it the first couple of times under the Welcome to fish, the friendly interactive shell message and after it was executed / displayed 10 times(?), hide it?
To be sure, emoji width is not up to the C library, but instead the terminal. (I wouldn't be surprised if it were font dependent too.)
I really like the idea of a "compatibility quiz" function! We could use it to detect support for 256 colors, 24-bit color, settable titles, and emoji widths.
Instead of quizzing the user, I think we could quiz the terminal by using an escape to get the cursor position before and after printing a spooky character.
Activity
faho commentedon Jan 4, 2016
This seems similar to #2199, no?
zanchey commentedon Jan 4, 2016
Yes, and I think also #750.
terlar commentedon Jan 4, 2016
I don't experience the same thing, but instead the color of the dash gets all weird, guess it is due to the overlapping. I don't see any repetition of other characters.
I am using
termiteon arch linux.ridiculousfish commentedon Jan 6, 2016
This failure mode is when fish's idea of where the cursor is gets out of sync with where it actually is. This can come about if fish thinks a character is single width but it's actually double width, or vice versa.
My font doesn't seem to have this character :(
xiaq commentedon Jan 25, 2016
There are two things you can do to contain the effect of the disparity between wcwidth and the actual terminal: 1) turn off autowrap whenever the editor is in control (echo '\033[?7l' to turn off, '\033[?7h' to turn on) and insert returns explicitly; 2) always re-render whole lines, from left to right, when the buffer changes. This way the line number is always correct and you minimize your dependency on the column number.
I hope the advice is useful. :)
pickfire commentedon Jan 26, 2016
@xiaq Hi, I didn't know you are back.
@terlar, what font are you using? @ridiculousfish and I too actually doesn't have that character.
pickfire commentedon Jan 26, 2016
@jakwings I didn't know that those two fonts isn't in my package manager. Trying to install it manually.
terlar commentedon Jan 26, 2016
Yes, I think this glyph comes from the symbola package. Not sure which one it fallbacks to. But I know I have symbola to cover these kind of things.
krader1961 commentedon Mar 25, 2016
I can't reproduce the problem using iTerm2 on OS X without a font installed that supports that character. So I see the single width undefined char glyph. Is it possible a recent change (such as the one I made to support the C locale better) has "fixed" this? Can anyone reproduce this problem using a fish built from git head? If so can you provide better directions for reproducing the problem than was in the original comment?
krader1961 commentedon Jun 19, 2016
After installing Symbola (from http://www.fonts2u.com/symbola.font) I can reproduce this. It's pretty clear that fish is using the wrong char width. From https://en.wikipedia.org/wiki/Dash:
So our
fish_wcwidth()implementation is out of date.P.S., It isn't just that character which renders weirdly. The Symbola font is ugly --- at least as handled by OS X Terminal.app. The inter-char spacing is just awful; even for plain ASCII chars.
floam commentedon Jun 19, 2016
It shouldn't be necessary to actually select Symbola as your font. Just install it and it will be used for odds and ends (like ⸻) with a regular terminal font selected.
For me this font+character does the same thing as the double-width emojis in the just-closed #750 -- just a bigger difference in width with this example.
krader1961 commentedon Jun 19, 2016
FWIW,
fish_wcwidth()returns 1 and the OS X El Capitan (10.11.6)wcwidth()returns -1.That's weird because on my system that emoji renders as a single-width char in both Terminal.app (where I explicitly made Symbola the primary font) and iTerm2 using Consolas. However, in both of those multiple instances of that char overlap each other. So it's pretty clear it should be treated as double-width but fish and my terminals are treating it as single-width.
69 remaining items
ridiculousfish commentedon Jul 10, 2018
@spacekookie emoji widths seem to be working pretty well on fish master (which includes a new wcwidth per #5081) with kitty terminal. You'll want to set emoji width to 2:
Please give it a try and report back! Really appreciate your patience with this.
albinekb commentedon Aug 14, 2018
I got emojis to work with

fish, version 2.7.1-1337-g09541e95by uncheckingUse Unicode version 9 widthsin iTerm2.app settings:ridiculousfish commentedon Aug 19, 2018
I'm confident this has been addressed via the
fish_emoji_widthvariable. Closing.albinekb commentedon Aug 20, 2018
@ridiculousfish so always when setting up fish we need to remember to set the variable to get emojis to work? Doesn't seem very "user friendly"..
faho commentedon Aug 20, 2018
Maybe. That's the point of the variable existing - some terminals/systems need it set to 2 and some to 1. In particular, you'll have to set it to 2 if your terminal is using the Unicode 9 widths, and to 1 otherwise - which means even with e.g. iTerm2, it depends on that option you talked about! Which means we can't do terminal detection via $TERM and friends like we do for e.g. cursor shape or truecolor support.
Unfortunately, there's nothing fantastic we can do, simply because there is no way for us to communicate with the terminal to figure out what width it uses. The variable is very much an admission of that fact.
It might be better to swap the default around - currently if you don't set that variable, we're using the pre-9 widths. Maybe it might be better to use the post-9 ones, or maybe we should wait another year or so until operating systems have caught up?
ridiculousfish commentedon Aug 21, 2018
Yeah these variables are super-lame, but there's no other option. The best we can hope for is excellent defaults (can still improve here) and fallback configurability.
I would guess the variable has the correct default sense today but could easily be wrong. Importantly though it only affects emoji that are in Unicode 8 or earlier (surprisingly few!). Emoji introduced in Unicode 9+ are always assumed to render per Unicode 9 widths.
terlar commentedon Aug 21, 2018
The best idea I can come up with would be to have an interactive function where the user is presented with a unicode character displayed with the two different settings and can select which one looks best, that would then automatically set and persisted as the
fish_emoji_width. Would that be possible?zanchey commentedon Aug 21, 2018
That sounds like a good enhancement - would you or anyone else be interested in producing something?
faho commentedon Aug 21, 2018
So, glibc got updated in 2.26, which was released on 2017-08-02, so about a year ago. For Ubuntu, that means everything after 17.10 does Unicode 9.
Notably, that leaves Ubuntu 16.04 (which is still supported and the current basis for WSL) and current Debian Stable out. I suspect other distributions to work the same, and I don't know how this works on macOS.
So that's basically a worst-case answer. Large parts of our user base are using older distributions, especially on servers, so I can't be sure that switching defaults will make it work for more users.
Alternatively we could do version-detection of the C library, but that might be too confusing given that there's often two knobs to deal with (the terminal's and ours) and keep in sync.
When is this shown? Does the user explicitly execute it? Is it a first-launch "wizard"?
Still, this might be the best idea we've seen so far. Just a simple
(with the heart symbol being the last \U escape I used - no idea if that's affected by this)
z3ntu commentedon Aug 21, 2018
Maybe show it the first couple of times under the
Welcome to fish, the friendly interactive shellmessage and after it was executed / displayed 10 times(?), hide it?ridiculousfish commentedon Aug 26, 2018
To be sure, emoji width is not up to the C library, but instead the terminal. (I wouldn't be surprised if it were font dependent too.)
I really like the idea of a "compatibility quiz" function! We could use it to detect support for 256 colors, 24-bit color, settable titles, and emoji widths.
YaLTeR commentedon Aug 26, 2018
Here's another idea for a quiz function:
With width = 1 the


^points at "2" and with width = 2 it points at "1".floam commentedon Dec 18, 2018
Instead of quizzing the user, I think we could quiz the terminal by using an escape to get the cursor position before and after printing a spooky character.