Skip to content

Fix terminal cursor position onPtyHostRestart#307212

Merged
anthonykim1 merged 3 commits into
mainfrom
anthonykim1/fixTerminalCursorOnConnect
Apr 1, 2026
Merged

Fix terminal cursor position onPtyHostRestart#307212
anthonykim1 merged 3 commits into
mainfrom
anthonykim1/fixTerminalCursorOnConnect

Conversation

@anthonykim1
Copy link
Copy Markdown
Contributor

@anthonykim1 anthonykim1 commented Apr 1, 2026

Resolves: #304257

Test by running command Restart Pty host with terminal.integrated.windowsUseConptyDll enabled on Windows, make sure as you type the cursor position is aligned with your prompt as expected.

ptyRestartFix.mp4

/cc @meganrogge

@anthonykim1 anthonykim1 added this to the 1.115.0 milestone Apr 1, 2026
@anthonykim1 anthonykim1 self-assigned this Apr 1, 2026
Copilot AI review requested due to automatic review settings April 1, 2026 18:13
@anthonykim1 anthonykim1 marked this pull request as ready for review April 1, 2026 18:17
Copy link
Copy Markdown
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 a Windows terminal cursor misalignment after a pty host restart (notably with ConPTY/PSReadLine), by emitting additional cursor-positioning escape sequences alongside the restart message before relaunching the terminal.

Changes:

  • On onPtyHostRestart, append Windows-specific \r\n padding and ESC[H to align the viewport/cursor before relaunch.
  • Keep the existing relaunch flow and user-facing restart message, but adjust the emitted data payload.

Comment thread src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts
Comment thread src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts Outdated
@anthonykim1 anthonykim1 marked this pull request as draft April 1, 2026 18:21
…er.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ishaerCastle
Copy link
Copy Markdown

@copilot /review

@anthonykim1 anthonykim1 marked this pull request as ready for review April 1, 2026 18:50
@anthonykim1 anthonykim1 merged commit 1d3e82f into main Apr 1, 2026
19 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/fixTerminalCursorOnConnect branch April 1, 2026 20:43
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators May 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

terminal restart for integrated pwsh can cause cursor to go to wrong location

4 participants