Registry Mirror
Skip to content

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #171

What changed

Tests

New cases in TUI.Test/BorderElementRenderTests.cs:

  • WideTitleNeverExtendsPastTheRightBorder covers CJK and emoji titles, some that fit and some that need truncating, in every TitleAlignment. It checks that the title write starts at x ≥ 1, that its last cell is at or before Width - 2 (measured with Spectre's own cell width), and that it holds no unpaired surrogate.
  • WideTitleThatFitsIsCentredByCellWidth: " 日本語 " in a 20-wide border is drawn whole at x = 6.
  • TruncatedEmojiTitleIsNotSplitMidSurrogatePair: "ab😀cd" at width 7 draws " ab ".

With the BorderElement.cs change reverted, 16 of these cases fail. With it, all pass. Full suite (dotnet test): 368/368 pass, and the Release build has no new warnings.

This branch starts from main and doesn't depend on #261 (the package-validation fix for #259). Until #261 lands, a push build of main still fails at pack.


Generated by Claude Code

BorderElement truncated and aligned its title by string length, so a
CJK title, two cells per char, overdrew the right corner and whatever
was beside it, and truncating "ab😀cd" left a lone high surrogate.
Truncate with TextElement.TakeCells and compute the Center and Right
offsets with MeasureCells, the helpers #141 added for TextElement.

Fixes #171

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW2kkxDaFKYetxhPcC9
@sonarqubecloud

Copy link
Copy Markdown

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.

BorderElement draws a CJK or emoji title past its right border, and a truncated title can end in half a surrogate pair

2 participants