Skip to content

Preserve blank MU* output lines in WorldSession - #18

Merged
HarryCordewener merged 3 commits into
mainfrom
copilot/fix-empty-lines-not-empty
Jul 31, 2026
Merged

Preserve blank MU* output lines in WorldSession#18
HarryCordewener merged 3 commits into
mainfrom
copilot/fix-empty-lines-not-empty

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Consecutive newlines from the server were collapsing in the client output path, so intentional blank lines were not rendered. This change ensures empty completed lines are preserved as explicit empty StyledLine entries.

  • Output-path behavior change

    • Updated WorldSession.OnOutputReceived (non-prompt path) to detect when parser/feed+flush emits no line for an output event.
    • In that case, it now emits StyledLine.Empty so blank server lines are retained in scrollback/output events.
  • Regression coverage

    • Added EmptyOutputLine_IsAppendedAsBlankLine in WorldSessionTests.
    • Asserts an empty telnet output event increases scrollback count and appends an empty line at the tail.
var emitted = false;
foreach (var completed in _parser.Feed(e.Text))
{
    ProcessOutputLine(completed);
    emitted = true;
}

var tail = _parser.Flush();
if (tail is not null)
{
    ProcessOutputLine(tail);
    emitted = true;
}
else if (!emitted)
{
    ProcessOutputLine(StyledLine.Empty);
}

Copilot AI linked an issue Jul 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix empty lines not appearing in output Preserve blank MU* output lines in WorldSession Jul 31, 2026
Copilot AI requested a review from HarryCordewener July 31, 2026 17:34
@HarryCordewener

Copy link
Copy Markdown
Member

@copilot An example of what a game can send, for confirmation.

Line one

This line three, previous line was empty, this is valid output. It came from the same received frame.

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot An example of what a game can send, for confirmation.

...

Confirmed and now covered by a regression test for that exact same-frame payload shape (Line one\n\nLine three): commit 44bfbf8.

@HarryCordewener
HarryCordewener marked this pull request as ready for review July 31, 2026 17:43
@HarryCordewener
HarryCordewener merged commit a7bbbe6 into main Jul 31, 2026
2 checks passed
@HarryCordewener
HarryCordewener deleted the copilot/fix-empty-lines-not-empty branch July 31, 2026 18:01
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.

Empty lines are not empty

2 participants