-
Notifications
You must be signed in to change notification settings - Fork 0
Drop the compatibility with go-runewidth #3
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
Conversation
More complete and correct, we think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the compatibility layer with go-runewidth and adopts a more consistent approach to character width calculation. The change simplifies the codebase by removing complex compatibility tests and exceptions that were previously needed to match go-runewidth behavior.
Key changes:
- Removed extensive comparison tests between displaywidth and go-runewidth implementations
- Simplified the test suite by replacing compatibility tests with a focused compatibility test
- Updated property naming conventions to be more descriptive and consistent
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| width_test.go | Removed comprehensive compatibility tests and replaced with simplified compatibility test focusing on known differences |
| width.go | Updated property names from _EAW_* to _East_Asian_* format and added surrogate character handling |
| internal/gen/unicode.go | Refactored property definitions to use a centralized approach and updated naming conventions |
| internal/gen/triegen/triegen.go | Fixed return type generation to use proper integer types instead of hardcoded property type |
| internal/gen/trie.go | Updated trie generation to use new property definitions and improved type handling |
| README.md | Updated benchmarks and added compatibility section documenting differences with go-runewidth |
| AGENTS.md | Updated development guidelines and removed references to compatibility maintenance |
| .changeset.md | Added documentation of changes related to Unicode Cf category usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Review SummaryThis PR makes a well-reasoned architectural decision to prioritize Unicode correctness over strict compatibility. The changes are generally well-executed with good documentation. ✅ Strengths
|
After working to have
displaywidthalways return identical widths compared togo-runewidth, I’ve come to believe it’s better to choose simplicity, consistency and (IMHO) more correctness.