Skip to content

Add Unicode grapheme handling guidance#4803

Merged
tig merged 1 commit intogui-cs:v2_developfrom
akrantz:docs/unicode-grapheme-guidance
Mar 6, 2026
Merged

Add Unicode grapheme handling guidance#4803
tig merged 1 commit intogui-cs:v2_developfrom
akrantz:docs/unicode-grapheme-guidance

Conversation

@akrantz
Copy link
Copy Markdown
Contributor

@akrantz akrantz commented Mar 6, 2026

Add guidance to CONTRIBUTING.md and .claude/rules/ about correct grapheme-aware text handling: use string.GetColumns() for width measurement, iterate by grapheme with GraphemeHelper.GetGraphemes() for rendering, and use AddStr instead of AddRune for grapheme clusters.

This documents the patterns that prevent the bugs fixed in #4798 and #4800 from recurring.

Fixes

Proposed Changes/Todos

  • Add "Unicode and Grapheme Handling" subsection to Coding Conventions in CONTRIBUTING.md
  • Add corresponding entries to "What NOT to Do" section
  • Add .claude/rules/unicode-graphemes.md for AI agent guidance

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

Add guidance to CONTRIBUTING.md and .claude/rules/ about correct
grapheme-aware text handling: use string.GetColumns() for width
measurement, iterate by grapheme with GraphemeHelper.GetGraphemes()
for rendering, and use AddStr instead of AddRune for grapheme
clusters.

This documents the patterns that prevent the bugs fixed in gui-cs#4798
and gui-cs#4800 from recurring.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@akrantz akrantz requested a review from tig as a code owner March 6, 2026 14:13
Copy link
Copy Markdown
Member

@tig tig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!!!

@tig tig merged commit eaa0e62 into gui-cs:v2_develop Mar 6, 2026
1 check passed
akrantz added a commit to akrantz/Terminal.Gui that referenced this pull request Mar 6, 2026
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.

2 participants