Skip to content

Fix chat terminal flicker during streaming#298598

Merged
meganrogge merged 1 commit intomicrosoft:mainfrom
sanchirico:fix-chat-terminal-flicker
Mar 2, 2026
Merged

Fix chat terminal flicker during streaming#298598
meganrogge merged 1 commit intomicrosoft:mainfrom
sanchirico:fix-chat-terminal-flicker

Conversation

@sanchirico
Copy link
Contributor

@sanchirico sanchirico commented Mar 1, 2026

The embedded terminal in chat flickers to blank during command execution. I used npm run test-node to reproduce/test. I think the issue is in chatTerminalCommandMirror.ts when it can't append incrementally it calls xterm.reset() then xterm.write(text) as two separate calls and xterm renders a blank frame in between.

I changed it to do write('\x1bc' + text) instead which puts the reset and the new content in the same write call so xterm handles it all before painting. \x1bc is the same thing as reset() according to the xterm.js docs (Perform a full reset (RIS, aka '\x1bc')). I saw terminalProcessManager.ts already does this for seamless relaunch so it seemed like a valid approach.

Tested on Windows and seems to not flicker now.

Tries to fix #293128 and #293579

Copilot AI review requested due to automatic review settings March 1, 2026 19:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes embedded chat terminal flicker during command output streaming by ensuring full terminal reset + rewrite happens atomically within a single xterm write, avoiding an intermediate blank paint.

Changes:

  • Replace reset() + write(text) (two operations) with a single write('\x1bc' + text) payload when a full rewrite is required.
  • Update the VT divergence unit test to reflect the new “single write with RIS” behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/terminal/browser/chatTerminalCommandMirror.ts Uses RIS (\x1bc) prepended to rewritten VT text to combine reset and redraw in one xterm write, preventing blank-frame flicker.
src/vs/workbench/contrib/terminal/test/browser/chatTerminalCommandMirror.test.ts Adjusts the divergence test to perform the reset via RIS in the same write call, matching production behavior.

Copy link
Collaborator

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

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

Thanks so much!

@meganrogge meganrogge added this to the March 2026 milestone Mar 2, 2026
@meganrogge meganrogge marked this pull request as ready for review March 2, 2026 15:44
@meganrogge meganrogge enabled auto-merge (squash) March 2, 2026 15:44
@meganrogge meganrogge merged commit cceac1a into microsoft:main Mar 2, 2026
21 of 22 checks passed
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.

Chat inline terminal flickers a lot

4 participants