Replies: 1 comment 3 replies
-
|
Nice detailed analysis.
This seems like a huge leap through. a. This requires the user to go through some pretty convoluted steps to get icons working Problem |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys,
Stuck on this bug:
~ 1 year ago MacOS icon hack was added here #1711
But as you see it fixes only half of the problem (selections are still broken).
I've found a proper way how to solve all this nasty MacOS icon problems without using ANY dirty hacks.
Story
Some time ago Nerd icons Material Design icon set was moved to
0xf0000-0xf1af0character range (https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points)This completely screws ncurses and strange things starts to happen:
Locale definitions are located in
/usr/share/localedir.Depending on user configuration some of this predefined locales is selected, and all locales ending with
.UTF-8has symlink forLC_CTYPEpointing to../UTF-8/LC_CTYPE.So character widths are baked into binary locale definition file:
/usr/share/locale/UTF-8/LC_CTYPE.UTF-8/LC_CTYPEfile shipped with MacOS makes all characters in0xf0000-0xf000erange to be 2 character wide.Which is a root cause of all those MacOS icon issues.
I've checked
ncursescode and he is relies solely onwcwidthcalls (notwcswidth) to get character widths.wcwidthitself relies onLC_CTYPElocale category.So to fix icon problems we need to create a proper
LC_CTYPEfile.Locale building
To build correct UTF-8
LC_CTYPEon*BSDsystems there is a tool calledmklocaleAnd luckily OpenBSD project shares pretty good UTF-8
LC_CTYPEsource file: https://github.com/openbsd/src/blob/master/share/locale/ctype/en_US.UTF-8.srcMacOS requires only a single modification to this file -
ENCODING "UTF8"->ENCODING "UTF-8"(additional dash).After that this file can be converted to binary form using:
Installation
There are many ways about how to install it.
According to
setlocaleApple libc will look up next directories (in this order) for locale definition files:Modification of
/usr/share/localerequires SIP disabling (https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection) and probably might break some system update in future, so its a bad way and generally should be avoided.So to install:
sudo mkdir -p /usr/local/share/locale/UTF-8sudo cp <path to binary LC_TYPE> /usr/local/share/locale/UTF-8~/.zshrcaddexport PATH_LOCALE=/usr/local/share/localeandexport LC_CTYPE=UTF-8After this steps icons in
nnnwill just work without any hacks.So i think
macos_icon_hack()can be completely removed and replaced with this little guide about how to make a proper locale on MacOS.What do u think?
Beta Was this translation helpful? Give feedback.
All reactions