Skip to content

emrg: TUI multi-line message fix — composer per-line render + preserve line breaks in user markdown (rant 2026-08-19T14:25:55) - #870

Merged
argszero merged 2 commits into
masterfrom
feature/tui-multiline-fix
Aug 19, 2026
Merged

emrg: TUI multi-line message fix — composer per-line render + preserve line breaks in user markdown (rant 2026-08-19T14:25:55)#870
argszero merged 2 commits into
masterfrom
feature/tui-multiline-fix

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Host rant 2026-08-19T14:25:55 — pasted multi-line text in the TUI lost its line breaks in two places:

  1. Composer input box — multi-line text rendered as one auto-wrapped blob
  2. Sent user message — Rich Markdown collapsed single \n into spaces → one long line, with the > prefix only on the first visual line

Changes

emrg/client/python_tui/widgets/composer.py — render one Line per logical line:

  • The text is split on \n; the first line carries the > prompt, continuation lines a same-width indent (matching ChatRow.render)
  • The cursor is drawn on the line it currently sits in (was previously a single flat Line, and buffer.py skips \n characters — the root cause of the flattened input)

emrg/client/python_tui/widgets/markdown.pyUserMarkdown preserves single newlines:

  • New _preserve_line_breaks() turns single \n into CommonMark hard breaks (line + two trailing spaces) so RichMarkdown renders each logical line separately
  • Blank lines (paragraph separators) and fenced code-block interiors are left untouched (trailing whitespace is significant there)
  • The > prefix stays on the first line only; continuation lines keep the same-width indent

Tests

  • New tests/test_composer.py (6 tests): multi-line render = one Line per logical line, no prompt on continuation lines, cursor placement on first/continuation lines, empty placeholder
  • tests/test_user_markdown.py (+3): single newlines preserved, blank lines remain paragraph separators, fenced code blocks untouched by the hard-break preprocessing
  • Suite: 988 collected, 987 passed + 1 skipped; import + CLI checks green (Agent.md count already synced)

…e line breaks in user markdown (rant 2026-08-19T14:25:55)

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle. CI test + test-windows PASS (run 32227017880); local suite 988 collected (987 passed + 1 skipped); composer per-line render + UserMarkdown hard-break preservation verified.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle. Second consecutive approval (cycles 912/913); head unchanged, CI test + test-windows PASS, MERGEABLE/CLEAN.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle. Head unchanged (b16c91f), CI test + test-windows both PASS (run 32227017880). Third consecutive approval.

@argszero

Copy link
Copy Markdown
OwnerAuthor

Maintainer conflict-resolution push (Committer): master advanced e401246 (#869 scheduler removal) while this PR was open; Agent.md doc-count line conflicted (PR said 988 against the pre-#869 base of 979; #869 dropped the suite to 968). Resolved by merging master in and setting the count to 977 (968 + 9 new tests from this PR) — verified locally: 976 passed + 1 skipped = 977 collected. New head c289e09; CI re-running.

@argszero
argszero merged commit a31fcd5 into masterAug 19, 2026
2 checks passed
@argszero
argszero deleted the feature/tui-multiline-fix branch August 19, 2026 08:12
argszero added a commit that referenced this pull request Aug 19, 2026
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto 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

@argszero