fix: Consistent single blank line between chat sections#98
Merged
Conversation
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.
d0346f6 to
2c25edb
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two sources of extra blank lines after the Assistant header:
display-agent-endinserted\n\n, but section headers prepend\n, creating triple newlines between turns. Fixed:\n\n→\n.Models send
\n\nat the start of responses. This created two visible blank lines between the setext underline and content. Fixed:display-message-deltastrips leading newlines from the first delta by checkingmessage-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.