Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to calculate width of UTF-8 encoded characters #12066

Merged
merged 1 commit into from
Dec 28, 2024
Merged

Conversation

NaN-git
Copy link

@NaN-git NaN-git commented Dec 15, 2024

Motivation

Nix assumes that each UTF-8 encoded character has a maximum width of 1, which can corrupt the terminal output, when wider characters are printed.

An additional header-only dependency widechar_width.h is introduced, which is basically a set of large lookup tables. I'm not sure whether the addition of the dependency is acceptable. Personally, I would have copied the lookup tables into the Nix source code.

Context

The functionality can be extended to verify UTF-8 encoded strings and to convert them to UCS-4 encoded strings.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@NaN-git NaN-git requested a review from edolstra as a code owner December 15, 2024 21:14
src/libutil/package.nix Outdated Show resolved Hide resolved
src/libutil/package.nix Outdated Show resolved Hide resolved
src/libutil/package.nix Outdated Show resolved Hide resolved
@NaN-git NaN-git force-pushed the utf-8 branch 4 times, most recently from e28764d to d54caed Compare December 17, 2024 23:28
@Mic92 Mic92 enabled auto-merge December 28, 2024 11:07
@Mic92 Mic92 merged commit b3eab02 into NixOS:master Dec 28, 2024
12 checks passed
@roberth roberth added the backport 2.25-maintenance Automatically creates a PR against the branch label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.25-maintenance Automatically creates a PR against the branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Progress bar width calculation does not recognize double-width characters
3 participants