MoonshotAI / MoonshotAI/kimi-code

fix(tui): prevent Tabby scroll jumps during streamed output

Open
#3,257 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Problem

In Tabby, Kimi Code can jump the terminal viewport to the top while a response is streaming. The issue is most visible with long conversations and high-frequency output.

Reproduction

  1. Open Kimi Code in Tabby.
  2. Start or resume a conversation with enough transcript content to exceed the terminal height.
  3. Send a prompt that produces a streamed response.
  4. Observe that Tabby can leave the viewport at the top instead of following the active response.

Investigation

Kimi Code uses TuiMainScreen by default. Its full-redraw path emits CSI 2 J, CSI H, and CSI 3 J to clear and rebuild the main screen and scrollback. Streamed updates can exercise this path when changed content lies above the tracked viewport.

Tabby previously fixed a related fast-output viewport race in Eugeny/tabby#11102, released in v1.0.235. Using Kimi Code's existing alternate-screen renderer for Tabby avoids the destructive main-screen redraw and provides an application-owned scrollable transcript viewport.

Proposed fix

  • Automatically select the existing TuiAltScreen renderer when TERM_PROGRAM=tabby.
  • Preserve KIMI_CODE_TUI_FULL_SCREEN=0 as an explicit opt-out and =1 as an explicit opt-in.
  • Add regression coverage for renderer selection and alternate-screen startup layout.
  • Document the Tabby behavior in both environment-variable reference pages.

I have a tested patch ready and will open a PR after maintainer approval.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing renderer selection between TuiMainScreen and TuiAltScreen, including how KIMI_CODE_TUI_FULL_SCREEN and TERM_PROGRAM=tabby are handled. Add regression coverage for renderer selection and alternate-screen startup layout, then update both environment-variable reference pages to document the Tabby behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.