Comments (2)
Вообще, как я заметил, этот подход предпочитают многие популярные консольные приложения.
Например NeoVim еще год назад выпилил у себя все wcwidth()
. Цитата мейнтейнера:
I wouldn't trust libc wchar functions over our own stuff in ten thousand years. There are good c unicode libraries out there we should consider (like libutf8proc and libgrapheme), but glibc or anything contaminated by the POSIX standard is not.
Вместо этого они при каждой сборке скачивают свежие таблицы с https://unicode.org/Public/UNIDATA/ и на Lua генерируют константные таблицы.
В коде выглядит это так:
https://github.com/neovim/neovim/blob/4946489e2e3eeca5c831faf9fe86cbf1229701e2/src/nvim/mbyte.c#L471-L507
У NeoVim огромное комьюнити, которое непрерывно развивает этот редактор. Так что они уже давно набили все возможные шишки с поддержкой юникода и каких-либо артефактов отрисовки там очень давно не встречалось. Стоит присмотреться к их кодовой базе получше. Конкретно в этом файле как раз собраны все функции работы с юникодом.
from far2l.
FYI
I looked at far3. It takes (file char_width.cpp ) a ready-made table from the Windows Terminal sources (file src\types\CodepointWidthDetector.cpp ). And WT takes it from a file generated by the CodepointWidthsFromUCD.ps1 script .
The CodepointWidthsFromUCD.ps1 script generates code based on Unicode UCD XmlDocument "ucd.nounihan.flat.xml"
The script uses 3 overrides (overrides width to 1):
<override first-cp="2500" last-cp="259F" ea="H" comment="box-drawing and block elements require 1-cell alignment" />
<override first-cp="4DC0" last-cp="4DFF" ea="H" comment="hexagrams are historically narrow" />
<override first-cp="FE20" last-cp="FE2F" ea="H" comment="narrow combining ligatures (split into left/right halves, which take 2 columns together)" />
from far2l.
Related Issues (20)
- far2l --tty key macros HOT 1
- Package for 10.15 not available in release for v2.6.1 HOT 2
- Unicode issues left — metabug
- Wayland issues left — metabug HOT 1
- F11 and combols doesn't work HOT 1
- 32-bit failed to build HOT 2
- New pick color features are not available in Options|Colors dialog HOT 1
- Pick color: highlighting with "Style" more than needed HOT 5
- Regarding files highlighting masks: use regexps instead of globs? HOT 7
- Files highlighting masks: minor correction needed HOT 1
- Files highlighting marks symbols by default: remove or change with mc tradition HOT 12
- Wrong cask url in homebrew, please fix it. HOT 1
- Fix 'Align file extensions'
- "Test archive" command leads to /dev/null corruption if run with privilege elevation
- Consider switching (back?) to codecvt as an alternative to iconv and Wine charset routines HOT 4
- Suggestion to use `find_package()` over `pkg_search_module()` for better logs
- Crash in colorer(?) HOT 6
- Function Menu: BreakKeys problem
- Colorer failed to build on ARM HOT 1
- Black and white mode is no longer pure black and white
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from far2l.