Skip to content

Conversation

@clipperhouse
Copy link
Owner

We don’t need as many distinct values in the property enum. There are only 4 meaningful categories:

  • Always width 2 (East Asian Wide and Fullwidth)
  • Always width 0 (control characters, format, combining marks)
  • Ambiguous (depends on options)
  • Emoji (depends on options)

Also no need to cast to property in the trie itself, just do it in the app

Copilot AI review requested due to automatic review settings October 12, 2025 01:28
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

This PR simplifies the character property system by consolidating multiple property types into four meaningful categories. The refactoring reduces complexity while maintaining the same functionality for width calculations.

  • Merges East_Asian_Fullwidth and East_Asian_Wide into a single East_Asian_Full_Wide property
  • Consolidates ControlChar, CombiningMark, and existing ZeroWidth into a unified ZeroWidth property
  • Removes type casting from the trie generation and moves it to the application layer

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
internal/gen/unicode.go Updates property definitions and bitmap building logic to use consolidated properties
internal/gen/trie.go Removes property type casting from trie generation and updates constant formatting
width.go Updates property lookups and width calculations to use new consolidated properties
width_test.go Updates test cases to use new property names and removes obsolete test cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@clipperhouse clipperhouse requested a review from Copilot October 12, 2025 19:11
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 9 out of 15 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@clipperhouse
Copy link
Owner Author

clipperhouse commented Oct 12, 2025

Excellent refactoring!

This PR successfully simplifies the property system by consolidating semantically identical properties:

  • Merges East_Asian_Fullwidth + East_Asian_Wide into East_Asian_Full_Wide (both always width 2)
  • Consolidates ControlChar, CombiningMark, and ZeroWidth into unified ZeroWidth (all width 0)

Key strengths:

  • All tests pass with no functional regression
  • Moves type casting from trie generation to application layer (better architecture)
  • Cleaner code: net -27 lines despite substantial refactoring
  • Performance maintained: 1.3-2.4x faster than go-runewidth on strings, 2-7.5x on runes
  • Better code organization with comparison/ package separation

The consolidation is semantically correct - the old properties had identical width calculation behavior. Nice work simplifying without changing functionality!


Review by Cursor AI using Claude Sonnet 4.5

@clipperhouse clipperhouse merged commit adc3ad9 into main Oct 12, 2025
8 checks passed
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