Skip to content

fix: keep a BorderElement title with a line break on the top border row [patch] - #188

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/151-border-title-newline
Sep 30, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/151-border-title-newline

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #151

Before: BorderElement truncated Title and passed it to WriteAt as given. A title such as "ab\ncd" sent the LF to the terminal, so cd was drawn on the next row over the left │.

After: each \r\n, \r or \n in the title is replaced with a space before truncation, so the title always stays on the top border row. This uses the same three separators TextElement splits on (#135). A space keeps the length the provider clips against equal to the drawn width.

Test: BorderElementRenderTests.TitleWithALineBreakIsDrawnOnOneRow covers all three separators with RecordingConsoleProvider. It asserts that no write contains \r or \n, and that ab cd is drawn on row 0. All three cases fail on main and pass with the fix. Full TUI.Test suite: 227/227.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMvgrK1uK13jn4qeVXxDi1


Generated by Claude Code

…ow [patch]

The title was truncated and written as given, so a \n or \r reached the
terminal, moved the rest of the title down a row and drew it over the left
border. Each line break in the title is now drawn as a space.

Fixes #151

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

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 5e42fe0 into main Sep 30, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/151-border-title-newline branch September 30, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants