I thought you might be interested in the article, Perfecting Terminal Character Width Using Correction Tables where I present a terminal-specific solution of width measurement, wcstwidth().
It would be a bit of work to integrate into this library but it is possible. It might look like:
- ensuring this project matches the python wcwidth specification,
- using ucs-detect as a sub-module and using code generation (like update-tables.py), create correction tables from its data/ folder,
- alternatively, the python wcwidth code generation script can generate ruby code with a few small jinja2 template files, the python wcwidth project could be used as submodule instead of ucs-detect raw data to generate the code tables.
- and writing new code (like _wcswidth.py) to make use of the new correction tables in width calculation
- and documentation about terminal-aware measurements, replacing the caveats to point to this solution.
Long-term:
On any update to ucs-detect results:
- update our git submodules of ucs-detect
- generate new "correction tables" in our ruby or python projects
- and conditionally make a release of our own.
Just a thought, no pressure, just wondering what you think
I thought you might be interested in the article, Perfecting Terminal Character Width Using Correction Tables where I present a terminal-specific solution of width measurement, wcstwidth().
It would be a bit of work to integrate into this library but it is possible. It might look like:
Long-term:
On any update to ucs-detect results:
Just a thought, no pressure, just wondering what you think