Skip to content

Fix terminal cursor position onPtyHostRestart - #307212

Merged
Anthony Kim (anthonykim1) merged 3 commits into
mainfrom
anthonykim1/fixTerminalCursorOnConnect
Apr 1, 2026
Merged

Anthony Kim (anthonykim1) merged 3 commits into
mainfrom
anthonykim1/fixTerminalCursorOnConnect

Conversation

@anthonykim1

@anthonykim1 Anthony Kim (anthonykim1) commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

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 Megan Rogge (@meganrogge)

@anthonykim1 Anthony Kim (anthonykim1) added this to the 1.115.0 milestone Apr 1, 2026
Copilot AI review requested due to automatic review settings April 1, 2026 18:13
@anthonykim1
Anthony Kim (anthonykim1) marked this pull request as ready for review April 1, 2026 18:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@anthonykim1
Anthony Kim (anthonykim1) marked this pull request as draft April 1, 2026 18:21
@ishaerCastle

Copy link
Copy Markdown

Copilot /review

@anthonykim1
Anthony Kim (anthonykim1) marked this pull request as ready for review April 1, 2026 18:50
@anthonykim1
Anthony Kim (anthonykim1) merged commit 1d3e82f into main Apr 1, 2026
19 checks passed
@anthonykim1
Anthony Kim (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