Skip to content

fix: preserve Copilot terminal viewport during startup - #97

Merged
dhhieu113pro merged 5 commits into
masterfrom
fix/copilot-terminal-viewport
Sep 7, 2026
Merged

fix: preserve Copilot terminal viewport during startup#97
dhhieu113pro merged 5 commits into
masterfrom
fix/copilot-terminal-viewport

Conversation

@dhhieu113pro

Copy link
Copy Markdown
Owner

Root cause

The native Windows terminal reports its real rows/columns as the HWND is laid out, but WindowsTerminalDevSpaceSurface.OnTerminalResized previously forwarded that size only when the PTY already existed. Standalone agent pages can be measured before PTY spawn completes, so the resize event was lost and Copilot could remain at the hard-coded 80x25 PTY geometry until another resize.

Fix

  • retain the latest valid native terminal viewport before PTY creation
  • spawn the PTY using the latest known viewport instead of always 80x25
  • replay the latest viewport atomically when the PTY attaches
  • keep subsequent native resize events synchronized
  • detach resize application during shutdown

Regression coverage

  • resize observed before PTY attach is replayed on attach
  • resize after PTY attach is applied immediately
  • invalid geometry does not replace the last valid viewport
  • detach stops future resize application

This is intentionally scoped to viewport synchronization; terminal layout, scrolling, keyboard handling, and standalone agent ownership are unchanged.

@dhhieu113pro
dhhieu113pro merged commit 467e0e1 into master Sep 7, 2026
23 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.

1 participant