Skip to content

Correcting width measurements by Terminal #32

Description

@jquast

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:

  1. update our git submodules of ucs-detect
  2. generate new "correction tables" in our ruby or python projects
  3. and conditionally make a release of our own.

Just a thought, no pressure, just wondering what you think

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions