Conversation
drwl
approved these changes
Feb 19, 2026
Owner
drwl
left a comment
There was a problem hiding this comment.
Thanks for adding this + the write up. As a person that uses mostly ascii characters, having other people help with unicode is greatly appreciated 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes incorrect column alignment in generated annotations when column names or comments contain fullwidth or CJK characters.
Previously, the width calculation relied on:
This approach is incorrect because UTF-8 byte size does not correspond to terminal display width. As a result, annotations could become misaligned when using certain Unicode characters.
This PR replaces the byte-size heuristic with a simplified Unicode range-based implementation that accounts for characters typically rendered as double-width in monospace terminals (CJK and fullwidth forms).
Problem
When using certain Unicode characters in column comments (e.g. currency symbols), annotation formatting could shift and break alignment.
Example case:
Before this change, alignment could be inconsistent depending on the characters used.
Before (broken alignment)
After (correct alignment)
Limitations
This remains a simplified
wcwidthimplementation and does not support:If full Unicode terminal-width compliance is ever required, the implementation could be replaced with a dedicated library such as unicode-display_width.