fix(coding-agent): keep one copy of each rendered user message line

The user message's Markdown pads and colors its own background instead of
sitting in a Box that kept a second full-width copy of every line. The output
is identical.
This commit is contained in:
Mario Zechner 2026-10-01 11:36:43 +02:00
parent 54c19a2529
commit e792ba131e
2 changed files with 8 additions and 6 deletions

View file

@ -17,6 +17,7 @@
- Fixed the sign-in URL printed by `/mcp login` not being clickable when it wraps ([#10186](https://github.com/earendil-works/pi/issues/10186)).
- Fixed `--provider` without `--model` being silently ignored and running the default model from another provider; it now fails with an error ([#10236](https://github.com/earendil-works/pi/issues/10236)).
- Fixed MCP servers that ask for more scope (`insufficient_scope`) requesting sign-in over and over. The new sign-in requested only the missing scopes, so the new token lost access the previous one had; it now keeps the granted scopes.
- Fixed user messages in the transcript keeping two full-width copies of every rendered line; they keep one, with identical output.
## [0.99.2] - 2026-09-30

View file

@ -1,4 +1,4 @@
import { Box, Container, Markdown, type MarkdownTheme } from "@earendil-works/pi-tui";
import { Container, Markdown, type MarkdownTheme } from "@earendil-works/pi-tui";
import type { MarkdownTransformer } from "../../../core/extensions/types.ts";
import { getMarkdownTheme, theme } from "../theme/theme.ts";
import { createMarkdownTransform } from "./markdown-transform.ts";
@ -37,15 +37,17 @@ export class UserMessageComponent extends Container {
private rebuild(): void {
this.clear();
const contentBox = new Box(this.outputPad, 1, (content: string) => theme.bg("userMessageBg", content));
contentBox.addChild(
// The Markdown pads and colors its own background: a Box around it would keep a second full-width copy of every
// line, with identical output.
this.addChild(
new Markdown(
this.text,
0,
0,
this.outputPad,
1,
this.markdownTheme,
{
color: (content: string) => theme.fg("userMessageText", content),
bgColor: (content: string) => theme.bg("userMessageBg", content),
},
{
preserveOrderedListMarkers: true,
@ -54,7 +56,6 @@ export class UserMessageComponent extends Container {
},
),
);
this.addChild(contentBox);
}
override render(width: number): string[] {