altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

feat: smooth streaming mode for TUI response rendering

Open anandgupta42 opened this issue 8 months ago • 0 comments

The TUI response rendering feels sluggish compared to Claude Code. Text appears in visible jumps and scrolling is jerky during LLM streaming.

Root cause: The <markdown> element re-lays out block elements (headers, code blocks, lists) on every token delta, causing layout height shifts that make stickyScroll jump.

Solution: Add ALTIMATE_SMOOTH_STREAMING feature flag that:

  1. Uses <code filetype="markdown"> during streaming (syntax colors without layout-shifting block elements), swaps to <markdown> after completion
  2. Pre-merges consecutive delta events in the SDK batch window
  3. Uses direct store path updates instead of produce() proxy
  4. Reduces scroll-to-bottom latency from 50ms to 0ms
  5. Memoizes trim() in TextPart to avoid redundant string scans

anandgupta42 avatar Mar 18 '26 23:03 anandgupta42