-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Make wcwidth configurable #4816
Conversation
This adds the cmake option "BROKEN_WCWIDTH" (to be set to "ON" or "OFF") and the configure option --[en,dis]able-wcwidth. Both default to enabling our fallback, but can be set to use the system's wcwidth again. Sequel to fish-shell#4554. See fish-shell#4571, fish-shell#4539, fish-shell#4609. On my system, this would fix fish-shell#4306.
The cmake and configure options name are unclear; I used the wrong one at first. I suggest using: It works as expected when I use
Note that I have no problem building master fish with cmake. |
These are now "--{en,dis}able-internal-wcwidth" and "ENABLE_INTERNAL_WCWIDTH".
Makes sense, yes.
I don't think this branch should change anything about that. Did you build with cmake previously? |
Well, I guess compiling with autotools then with cmake doesn’t work very well, because it works with a clean clone. Well, I guess because when I build fish with cmake, master or your branch, it’s so broken I can’t test emojis: when I launch
Maybe worth another issue though. |
Yeah, the cmake build doesn't set up fish_function_path so it can be used without installing. It's a different issue, yes. |
OK, I can confirm that’s working just fine when building with cmake then installing. |
I'll merge this on saturday if there are no objections. |
thanks! |
What's a system where this helps? I don't object to merging but I want to understand where our Unicode support is lacking. |
CMakeLists.txt
Outdated
@@ -90,6 +90,13 @@ SET_SOURCE_FILES_PROPERTIES(src/fish_version.cpp | |||
PROPERTIES OBJECT_DEPENDS | |||
${CMAKE_CURRENT_BINARY_DIR}/${FBVF}) | |||
|
|||
OPTION(ENABLE_INTERNAL_WCWIDTH "use fallback wcwidth" ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I suggest this is just "INTERNAL_WCWIDTH" in line with other options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I was wondering if we shouldn’t make the workaround opt-in: I think it makes more sense that the default is using the system |
Mine, for instance. Archlinux with glibc 2.26. If I use either
with my right-prompt, I'll get a nice little staircase-effect like this: (That's after I've typed one "e" in each of the terminals - though note that in this case the suggestion is also triggering it) One of the offenders is \U26A1 ("HIGH VOLTAGE SIGN"). But the point is, and I've brought this up before, that even if we squash that one, others may pop up. And, as I've said in #4571 (where the terminal rendered a zero-width-space with a width that was not zero), sometimes it's better for us to be wrong in the same way as the terminal. And while it's certainly not perfect to rely on the system wcwidth (they frequently have bugs), it's the best chance we have to get the same value as the terminal. And if the terminal uses its own implementation, there's nothing we can do that won't break fish for all other terminals.
So I've come to believe that we really should use the system wcwidth. This PR is a compromise so that people on old systems or weird terminals that we can't test before the next release can still use fish. Long term, I'd love it if we switched the default to system wcwidth and let people on RHEL 6 and the like build it with the internal one (because of stuff like ssh - where you have a terminal on a new system, with a new wcwidth, but a shell on an old one). But there's no real harm in being a little conservative. |
* Make wcwidth configurable This adds the cmake option "INTERNAL_WCWIDTH" (to be set to "ON" or "OFF") and the configure option --[en,dis]able-internal-wcwidth. Both default to enabling our fallback, but can be set to use the system's wcwidth again. Sequel to fish-shell#4554. See fish-shell#4571, fish-shell#4539, fish-shell#4609. On my system, this would fix fish-shell#4306.
This is important when typing characters such as ⚡(U+26A1 HIGH VOLTAGE SIGN), otherwise fish computes a different character width than the terminal. See fish-shell/fish-shell#4816
This adds the cmake option
"BROKEN_WCWIDTH""ENABLEINTERNAL_WCWIDTH" (to be set to "ON" or"OFF") and the configure option --[en,dis]able-internal-wcwidth.
Both default to enabling our fallback, but can be set to use the system's wcwidth again.
Sequel to #4554.
See #4571, #4539, #4609.
On my system, this would fix #4306.
Ideally, this would default to using the system wcwidth instead - as noted in #4571, it doesn't really matter whether we get the width "right". What matters is that we get the same width that the terminal gets, and that's much more likely with a shared implementation. I have gotten vte, urxvt, st and xterm to disagree with my right-prompt, which causes an interesting stair-case effect that makes fish nigh-unusable.
TODOs:
As previously noted, I suck at build systems, so someone checking this would be much appreciated.