Skip to content

adding wcwidth for char in libcore #15224

Closed
@kwantam

Description

@kwantam

It would be nice to have a wcwidth-alike, presumably living in core::unicode and exposed as a char method. I've got a working local implementation of this that automatically generates the search tables for 0- and double-width characters from the latest unicode data (this does not need to be done at build time, only when the unicode charsets are updated).

If this is a desirable feature, can you give me some guidance as to

  1. What the function should be called (wcwidth is pretty C-ish and maybe not so Rustic).
  2. Where the autogen stuff should live (maybe in src/etc/unicode_width?)
  3. Whether you'd like me to add a wcwidth_cjk-equivalent function, whose behavior is slightly different on certain spacing characters, as described in http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c (see comment above the mk_wcwidth_cjk function).

Any other thoughts are, of course, appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions