Skip to content

Default value for the ambiguousIsNarrow option #38

@ehmicky

Description

@ehmicky

The default value for the ambiguousIsNarrow option introduced in 5.1.0 might surprise some users. It might also be a breaking change for a few of them. For example, some characters used fairly commonly in terminal outputs like ± now have a width of 2 instead of 1 by default (since ambiguousIsNarrow defaults to false). In my case, this broke the line wrapping logic of my CLI application.

The best value for this option seems to depend on whether the user is using an East Asian legacy character encoding. Are those legacy character encodings more common among East Asian languages users than non-legacy ones? If not, should the default value be switched to true?

Another solution would be to make the default value depend on the machine's locale? os-locale could be used for that purpose, providing it is memoized (since it spawns processes, which can be slow).

If the default value does remain false, since this might be unexpected for developers of other languages, it might make sense to document that users of this library should tweak this option based on whether they expect to use an East Asian legacy character encoding.

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