Skip to content

feat(leantui): apply display-only Markdown transformers - #4953

Open
rumpl wants to merge 1 commit into
rumpl/markdown-transform-hooksfrom
rumpl/markdown-transform-leantui
Open

rumpl wants to merge 1 commit into
rumpl/markdown-transform-hooksfrom
rumpl/markdown-transform-leantui

Conversation

@rumpl

@rumpl rumpl commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

Runs settings.markdown_transformers (#4952) in the lean TUI too.

  • Transformed replies render with their SGR styling.
  • Rows already in terminal scrollback are never cleared. Changed text is written again below them, as with other late Markdown updates, and styling-only changes are skipped.
  • Replies complete when their saved message arrives or when the last stream of their session stops. Completion does not flush the pending block, so chunk boundaries do not depend on transformers.
  • The final frame, which nothing redraws, shows each reply's latest result. A result that arrived before the batched refresh is picked up; a snapshot still waiting for its result shows its source.

Last of a stack:

  1. fix(markdown): strip terminal controls from rendered text #4948: strip terminal controls
  2. feat(markdown): render trusted SGR styling and replay it across wraps #4949: render trusted SGR styling
  3. feat: add display-only Markdown transformers #4952: display-only Markdown transformers
  4. This PR: Markdown transformers in the lean TUI

Validation

  • task build; race tests for pkg/markdowntransform, pkg/tui/..., pkg/leantui/... (lean transform tests 10× and 6× under load)
  • golangci-lint reports no new issues; Windows go vet passes
  • task test fails only on the existing TestACPRuntimeConfig_ModelSwitchingIsSessionOwned

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the lean TUI display-only transformer integration.

No open issues 🎉

What changed in this PR

Extends the existing display-only Markdown transformer pipeline to the lean TUI, while keeping stored replies, model context, and copied messages unchanged.

Changes:

  • Connects transformers to the lean event loop with batched refreshes and message/session completion tracking.
  • Renders transformer styling, preserves terminal scrollback, and shows the latest result or source text in the final frame.
  • Adds focused tests and documents lean TUI support.
File Description
pkg/​leantui/​update.go Reattaches transformers on session resume and marks restored replies complete.
pkg/​leantui/​ui/​transform_test.go Tests transformed rendering, completion, final-frame behavior, and scrollback preservation.
pkg/​leantui/​ui/​transcript.go Tracks per-block transform state, refreshes cached output, and settles final rendering.
pkg/​leantui/​ui/​render.go Adds rendering that preserves trusted transformer SGR styling.
pkg/​leantui/​transform_test.go Tests compaction, nested-stream completion, and unchanged chunk boundaries.
pkg/​leantui/​leantui.go Starts transformers, handles asynchronous refreshes, and prepares the final frame.
pkg/​leantui/​events.go Tracks session streams and completes replies on saved-message or stream-stop events.
docs/​configuration/​user-settings/​index.md Documents lean TUI transformer support and scrollback behavior.

Review effort: Balanced

Run settings.markdown_transformers in the lean TUI too. Transformed
replies render with their SGR styling; rows already in terminal
scrollback are never cleared, so changed text is written again below
them, and styling-only changes are skipped.

Replies complete when their saved message arrives or the last stream of
their session stops, without flushing the pending block, so chunk
boundaries do not depend on transformers. The final frame shows each
reply's latest result, or its source when that snapshot has none yet.

Signed-off-by: Djordje Lukic <[email protected]>
@rumpl
rumpl force-pushed the rumpl/markdown-transform-leantui branch from 73b9197 to ade921e Compare November 17, 2026 22:58
Copilot AI balanced review requested due to automatic review settings November 17, 2026 22:58
@aheritier aheritier added area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Nov 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Starting /new during a live reply leaves archived assistant segments marked as streaming, causing transformers to display stale in-progress output.

1 open issue

Review effort: Balanced

Comment thread pkg/leantui/update.go
m.ignoredUsers = nil
m.busy = false
m.streamDepth = 0
m.sessionStreams.Reset()

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants