Skip to content

core(renderer): handle ANSI text written to stdout in split-footer mode#1108

Open
justjake wants to merge 4 commits into
anomalyco:mainfrom
justjake:upstream-external-output-rendering
Open

core(renderer): handle ANSI text written to stdout in split-footer mode#1108
justjake wants to merge 4 commits into
anomalyco:mainfrom
justjake:upstream-external-output-rendering

Conversation

@justjake
Copy link
Copy Markdown
Contributor

When externalOutputRendering: "terminal-native" in CliRendererConfig, commit bytes written to captured stdin with minimal transformation, instead of re-rendering them.

In this mode, we compute the layout effect of each chunk by splitting on \n, then using strip-ansi and string-width to get the width of the line before wrapping.

The outcome is that ANSI styling bytes written to stdout are rendered by the terminal itself without needing to implement ANSI->OpenTUI conversion.

Before (bun run packages/examples/src/split-footer-streaming-demo.ts):

CleanShot 2026-05-25 at 16 47 33@2x

After (OTUI_SPLIT_STREAMING_DEMO_RENDERING=terminal-native bun run packages/examples/src/split-footer-streaming-demo.ts):

CleanShot 2026-05-25 at 16 48 34@2x

@kommander
Copy link
Copy Markdown
Collaborator

@simonklee needs to check that when he's back

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.

2 participants