MoonshotAI / MoonshotAI/kimi-code

VS Code integrated terminal: mouse scroll/drag jumps view back to top of conversation

Open
#2,193 1 comment 1 reaction 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

When running kimi inside the VS Code integrated terminal (via Remote-SSH), scrolling the mouse wheel or dragging the terminal panel causes the TUI view to jump back to the top of the conversation (the first message). The problem does not occur in external terminals (Windows Terminal, iTerm2, etc.), and it does not occur with opencode in the same VS Code terminal.

The issue worsens as the session grows longer — short sessions are barely affected, long sessions (many turns, large tool outputs) trigger the jump on almost every scroll/drag.

Environment

  • kimi-code: 0.29.1
  • Node: v24.15.0
  • Platform: linux/x64 (Ubuntu 26.04, Remote-SSH)
  • VS Code: 1.130.0 (TERM_PROGRAM=vscode), connecting via vscode-server
  • Shell: /bin/bash, TERM defaults to xterm-256color in the integrated terminal

Reproduction

  1. Open VS Code, connect to a remote host via Remote-SSH.
  2. Open an integrated terminal (`Ctrl+``).
  3. Start kimi and have a conversation with several turns (5+), ideally including tool calls with non-trivial output.
  4. Scroll the mouse wheel up/down, or drag the terminal panel border to resize.
  5. The view jumps to the top of the conversation.

Root cause analysis

From inspecting the binary, kimi-code's TUI uses:

  • Alternate screen buffer (full-screen mode)
  • Mouse tracking (enableMouse() — mouse events are sent to the app instead of scrolling the terminal scrollback)

In this combination, VS Code's integrated terminal forwards the wheel event to kimi, which triggers a re-render and re-anchors the cursor/view to the content output point (top of conversation). This is a known interaction problem between VS Code's terminal renderer and full-screen TUI apps that capture mouse events.

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 reproducing the jump in a VS Code Remote-SSH integrated terminal with a long kimi session, then inspect the TUI entry points handling alternate-screen mode and mouse tracking. No source file or test is named in the issue. Done means scrolling or dragging no longer returns the view to the top in VS Code while existing terminal behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript, vscode
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.