Skip to content

Conversation

@clipperhouse
Copy link
Owner

New IgnoreControlSequences option to treat escape sequences as zero width. The actual meaningful change is in uax29, which will parse the sequences as single graphemes. Then in displaywidth we simply check the leading character as being C0.

Copilot AI review requested due to automatic review settings February 8, 2026 16:54
Copy link
Contributor

Copilot AI left a 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.IgnoreControlSequences and wire it into grapheme iteration for String/Bytes.
  • Treat multi-byte grapheme clusters that start with a C0 control byte as width 0.
  • Bump github.com/clipperhouse/uax29/v2 dependency to v2.6.0 and 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.

Copy link
Contributor

Copilot AI left a 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.

@clipperhouse clipperhouse merged commit 41280f9 into main Feb 8, 2026
10 checks passed
@clipperhouse clipperhouse deleted the ansi branch February 8, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant