Skip to content

fix: Consistent single blank line between chat sections#98

Merged
dnouri merged 1 commit intomasterfrom
blankline-woes
Feb 6, 2026
Merged

fix: Consistent single blank line between chat sections#98
dnouri merged 1 commit intomasterfrom
blankline-woes

Conversation

@dnouri
Copy link
Owner

@dnouri dnouri commented Feb 6, 2026

Two sources of extra blank lines after the Assistant header:

  1. display-agent-end inserted \n\n, but section headers prepend \n, creating triple newlines between turns. Fixed: \n\n\n.

  2. Models send \n\n at the start of responses. This created two visible blank lines between the setext underline and content. Fixed: display-message-delta strips leading newlines from the first delta by checking message-start-marker == streaming-marker (no content inserted yet).

The GUI integration test (no-consecutive-blank-lines) didn't catch this because the test model (qwen3:1.7b) doesn't produce leading \n\n. New unit tests use "\n\nHi" as delta content to match real model behavior.

Two fixes for extra blank lines in chat buffer:

1. display-agent-end: normalize to single trailing \n (was \n\n).
   Section headers prepend \n, so \n\n created triple newlines.

2. display-message-delta: strip leading newlines from first delta.
   Models send \n\n before first content, creating blank lines
   after the setext header. Detected by comparing markers: when
   message-start-marker equals streaming-marker, no content has
   been inserted yet.
@dnouri dnouri merged commit ee00f4d into master Feb 6, 2026
6 checks passed
@dnouri dnouri deleted the blankline-woes branch February 6, 2026 17:27
dnouri added a commit that referenced this pull request Feb 25, 2026
Two fixes for extra blank lines in chat buffer:

1. display-agent-end: normalize to single trailing \n (was \n\n).
   Section headers prepend \n, so \n\n created triple newlines.

2. display-message-delta: strip leading newlines from first delta.
   Models send \n\n before first content, creating blank lines
   after the setext header. Detected by comparing markers: when
   message-start-marker equals streaming-marker, no content has
   been inserted yet.
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