.NET: Fix render dupe and text input clear bugs, and improve guardrail error messaging#6136
Merged
westey-m merged 9 commits intoMay 28, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET Harness console UI rendering logic to better handle terminal wrapping and bottom-panel mode switches.
Changes:
- Adds ANSI-aware visible string length measurement.
- Updates queued/scroll text height calculations to account for wrapping.
- Forces bottom-panel repaint when switching modes to avoid stale content.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
dotnet/samples/02-agents/Harness/ConsoleReactiveComponents/AnsiEscapes.cs |
Adds visible-length calculation for ANSI-styled strings. |
dotnet/samples/02-agents/Harness/ConsoleReactiveComponents/TextPanel.cs |
Updates queued panel height/rendering to account for wrapped physical rows. |
dotnet/samples/02-agents/Harness/ConsoleReactiveComponents/TextScrollPanel.cs |
Updates scroll-panel last-item offset calculation for wrapped rows. |
dotnet/samples/02-agents/Harness/Harness_Shared_Console/HarnessAppComponent.cs |
Passes console width into queued-panel measurement and invalidates bottom child on mode changes. |
Comments suppressed due to low confidence (1)
dotnet/samples/02-agents/Harness/ConsoleReactiveComponents/TextPanel.cs:58
- This loop compares the global
currentRowagainst the current item'slineCount, so after rendering a one-line itemcurrentRowis already 1 and subsequent one-line items are skipped entirely. It also advances only one row for a logical line that may wrap. Track rows rendered for the current item separately and advancecurrentRowby the physical rows occupied by each logical line/item.
for (int j = 0; j < lines.Length && currentRow < lineCount; j++)
{
Console.Write(AnsiEscapes.MoveAndEraseLine(props.Y + currentRow));
Console.Write(lines[j]);
currentRow++;
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
dotnet/samples/02-agents/Harness/ConsoleReactiveComponents/TextPanel.cs:58
lineCountnow includes wrapped terminal rows, butcurrentRowis still incremented only once per logical line. For a long line that wraps, the leftover-line cleanup starts too early and erases the wrapped continuation rows (and later items can be positioned over them); advancecurrentRowby the physical row count for each logical line instead.
int lineCount = CountPhysicalLines(text, props.Width);
for (int j = 0; j < lines.Length && currentRow < lineCount; j++)
{
Console.Write(AnsiEscapes.MoveAndEraseLine(props.Y + currentRow));
Console.Write(lines[j]);
currentRow++;
This was referenced Jun 2, 2026
Open
Merged
Closed
This was referenced Jun 10, 2026
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.
Motivation and Context
Description
Contribution Checklist