-
Notifications
You must be signed in to change notification settings - Fork 0
Option to treat control sequences as 0 width #20
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
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
Adds an IgnoreControlSequences option to treat ANSI/control-sequence graphemes as zero-width, leveraging updated uax29 grapheme parsing.
Changes:
- Add
Options.IgnoreControlSequencesand wire it into grapheme iteration forString/Bytes. - Treat multi-byte grapheme clusters that start with a C0 control byte as width 0.
- Bump
github.com/clipperhouse/uax29/v2dependency tov2.6.0and add tests for ANSI sequences.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| width.go | Adds new option, forwards it to the grapheme iterator for width calculation, and adjusts width logic for C0-led multi-byte graphemes. |
| width_test.go | Adds tests asserting zero width for ANSI/control sequences when the new option is enabled. |
| go.mod / go.sum | Updates uax29 dependency to v2.6.0. |
| comparison/go.mod / comparison/go.sum | Keeps comparison module dependency graph in sync with updated uax29 version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
New
IgnoreControlSequencesoption to treat escape sequences as zero width. The actual meaningful change is inuax29, which will parse the sequences as single graphemes. Then indisplaywidthwe simply check the leading character as being C0.