Skip to content

fix(terminal): keep restored history when ConPTY repaints after a resize - #33577

Merged
nwparker merged 3 commits into
mainfrom
nwparker/daemon-resize-padding
Oct 25, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/daemon-resize-padding

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​134 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​134
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

ELI5

On Windows, if you restart Orca and a restored terminal gets resized, the terminal could lose about a screen of its old output, and the new prompt could end up glued to the old one (deep$ orca@…deep$). This stops that.

What Changed

Before: a Windows terminal restored after Sleep was fine until the app was killed and relaunched. The relaunched window's first fit resizes the terminal smaller and back. The next saved history then had:

  • one screen's worth of older lines missing;
  • the new shell's prompt on the same row as the restored prompt.

That saved history is replayed on every later restore.

After: restored history and its padding survive the resize.

Mechanism: the terminal daemon keeps its own emulator copy of each terminal, and that copy is what gets saved as history.

  • When that emulator grew taller, it pulled lines back out of scrollback into the screen, as a Unix terminal does.
  • On Windows every daemon terminal runs inside ConPTY, including WSL shells. After a resize, ConPTY repaints the screen it owns from the top. Its picture of the screen holds only the new shell's rows.
  • So the repaint overwrote the history lines the emulator had just pulled back.
  • xterm has a mode for exactly this (windowsPty): when the screen grows, it adds blank rows at the bottom instead of pulling scrollback down. The window already uses it for native Windows panes.
  • This change turns it on for ConPTY-backed daemon terminals, using the same build-number rule the window uses. That rule moved into src/shared/xterm-conpty-options.ts, so the daemon and the window share one copy.

Why

The emulator has to model the grid the same way ConPTY does, or ConPTY's repaints land on the wrong rows.

Alternatives considered:

  • Re-blanking or suppressing ConPTY's repaint: would fight ConPTY and break other repaints.
  • Avoiding the resize: the window has to fit the terminal to its real size eventually, so the resize can't be skipped.

macOS, Linux and SSH daemons are unchanged: they don't use ConPTY.

Linked Issue

N/A (maintainer).

Visual Proof

N/A: Windows/WSL history content; covered by the daemon test and the Windows verify run.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New src/main/daemon/session-conpty-resize-history.test.ts checks the daemon's teardown snapshot, which is what Sleep saves.

    • It models ConPTY's own screen. That screen holds only what the shell wrote, at ConPTY's current height: a shrink keeps the cursor row and drops the rows above it, and every resize repaints that screen from the top.
    • It runs through four height sequences: shrink then grow (58→2→58), a smaller shrink (→10→58), two steps (→2→30→58), and growing past the original height (→70→58).
    • In each, every restored row and every shell row appears exactly once and in order, and the restored prompt keeps its padding.
    • Without the fix, the shrink cases fail.
  • pnpm tc passes, and so do audit:code-quality:native, audit:code-quality:type-aware, audit:anti-slop, the ratchets and oxlint.

  • src/main/daemon and the window's Windows-PTY tests pass. The exceptions are 20 real-shell tests (shell-ready.test.ts, repro-13767-…), which fail the same way on clean main on macOS.

  • The original failure was seen on Windows + WSL in an internal verify run: a Sleep → Wake → kill and relaunch → Sleep sequence.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Platforms: Windows daemon only. macOS, Linux and SSH are unchanged.
  • Build numbers: on Windows builds older than 21376, xterm's ConPTY mode also turns off reflow, matching what the window already does.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

The Windows daemon's emulator grew rows the way a Unix terminal does,
pulling scrollback back into the screen. ConPTY then repaints the grid
it owns from the top and overwrote those rows, so a relaunched window's
first fit lost about a screen of restored history and printed the new
shell's prompt onto the restored prompt's row. Give ConPTY-backed daemon
sessions (WSL shells included) xterm's windowsPty resize model, as the
window already does for native Windows panes.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a00096da-9ee8-4c28-9a19-cca6fbe9ccdf
Commits

Reviewing files that changed from the base of the PR and between 5c1c31e and f094898.

Files selected for processing: 1
  • src/main/daemon/session-conpty-resize-history.test.ts
Walkthrough

The change adds shared helpers for parsing Windows build numbers and constructing xterm ConPTY options. The renderer now uses these helpers. The daemon passes backend-specific options through its session output pipeline to the headless terminal. A regression test covers checkpoint restoration after a ConPTY resize and repaint.

Priority: Normal

Merge Risk: Moderate · up to 5c1c3

WSL terminal history can display differently from the daemon’s saved state after a resize. Align the two resize models before merging unless this difference is intentional.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: preserving restored terminal history when ConPTY repaints after a resize.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description follows the required structure and clearly explains the user impact, technical cause, implementation, alternatives, scope, testing, platform considerations, and checklist …
Full details: Description check

Explanation

The pull request description follows the required structure and clearly explains the user impact, technical cause, implementation, alternatives, scope, testing, platform considerations, and checklist status. The maintainer correctly marks the linked issue as N/A. Manual local testing is unchecked, and the exact status of all required commands (pnpm lint, pnpm typecheck, pnpm test, and pnpm build) is not stated, but the description provides sufficient test and CI context.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d66e8f82-9716-41f0-a089-a4d828e40bc0
Commits

Reviewing files that changed from the base of the PR and between c074ec5 and 5c1c31e.

Files selected for processing: 7
  • src/main/daemon/headless-emulator.ts
  • src/main/daemon/session-conpty-resize-history.test.ts
  • src/main/daemon/session-output-pipeline.ts
  • src/main/daemon/session-output-plane.ts
  • src/main/daemon/session.ts
  • src/renderer/src/lib/pane-manager/windows-pty-compatibility.ts
  • src/shared/xterm-conpty-options.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment on lines +30 to +31
opts.ownerBackend && opts.ownerBackend !== 'posix-pty'
? buildXtermConptyOptions(parseWindowsBuildNumber(release()))

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.

Major · Data Integrity & Integration · Heavy lift

🔎 Supported by static analysis

Script executed:

#!/bin/bash
# Inspect renderer option builders and their call sites for WSL panes.
rg -n -C 5 'buildWindowsPtyCompatibilityOptions\s*\(|buildLocalConptyTerminalOptions\s*\(|windowsPty\s*:' src/renderer

Repository: stablyai/orca

Length of output: 19686


Script executed:

rg -n -C 3 -F -e "'windows-wsl'" -e 'ownerBackend' src/main || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 10907


Web query:

xterm.js windowsPty option resize behavior row increase scrollback reflow conpty buildNumber

Result:

<source_evidence>
<source kind="open_page">
<title>xterm.js/typings/xterm.d.ts at master · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts</location>
<excerpt>citeturn1view0 [wordlim: 200] Crawled: yesterday; Content type: text/html; Source: open({&quot;ref_id&quot;:&quot;turn0search0&quot;,&quot;lineno&quot;:null}); Total lines: 3925
L2280: * Whether the cursor blinks. The blinking will stop after 5 minutes of idle
L2281: 
L2282: * time (refreshed by clicking, focusing or the cursor moving). The default
L2283: 
L2284: * is false.
L2285: 
L2286: */
L2287: 
L2288: cursorBlink?: boolean;
L2289: 
L2290: /**
L2291: 
L2292: * The interval in milliseconds for the blink attribute. This is the amount
L2293: 
L2294: * of time text remains visible or hidden before toggling. Set to 0 to
L2295: 
L2296: * disable blinking. The default is 0.
L2297: 
L2298: */
L2299: 
L2300: blinkIntervalDuration?: number;
L2301: 
L2302: /**
L2303: 
L2304: * The style of the cursor when the terminal is focused.
L2305: 
L2306: */
L2307: cursorStyle?: &#39;block&#39; | &#39;underline&#39; | &#39;bar&#39;;
L2308: 
L2309: /**
L2310: 
L2311: * The width of the cursor in CSS pixels when `cursorStyle` is set to &#39;bar&#39;.
L2312: 
L2313: */
L2314: 
L2315: cursorWidth?: number;
L2316: 
L2317: /**
L2318: 
L2319: * The style of the cursor when the terminal is not focused.
L2320: 
L2321: */
L2322: 
L2323: cursorInactiveStyle?: &#39;outline&#39; | &#39;block&#39; | &#39;bar&#39; | &#39;underline&#39; | &#39;none&#39;;
L2324: 
L2325: /**
L2326: 
L2327: * Whether input should be disabled.
L2328: 
L2329: */
L2330: 
L2331: disableStdin?: boolean;
L2332: 
L2333: /**
L2334: 
L2335: * A {@link Document} to use instead of the one that xterm.js was attached
L2336: * to. The purpose of this is to improve support in multi-window
L2337: 
L2338: * applications where HTML elements may be references across multiple
L2339: 
L2340: * windows which can cause problems with `instanceof`.
L2341: 
L2342: *
L2343: 
L2344: * The type is `any` because using `Document` can cause TS to have
L2345: 
L2346: * performance/compiler problems.
L2347: 
L2348: */
L2349: 
L2350: documentOverride?: any | null;
L2351: 
L2352: /**
L2353: 
L2354: * Whether to draw bold text in bright colors. The default is true.
L2355: 
L2356: */
L2357: 
L2358: drawBoldTextInBrightColors?: boolean;
L2359: 
L2360: /**
L2361: * The scroll speed multiplier used for fast scrolling when `Alt` is held.
L2362: 
L2363: */
L2364: 
L2365: fastScrollSensitivity?: number;
L2366: 
L2367: /**
L2368: 
L2369: * The font size used to render text.
L2370: 
L2371: */
L2372: 
L2373: fontSize?: number;
L2374: 
L2375: /**
L2376: 
L2377: * The font family used to render text.
L2378: 
L2379: */
L2380: 
L2381: fontFamily?: string;
L2382: 
L2383: /**
L2384: 
L2385: * The font weight used to render non-bold text.
L2386: 
L2387: */
L2388: 
L2389: fontWeight?: FontWeight;
L2390: 
L2391: /**
L2392: 
L2393: * The font weight used to render bold text.
L2394: 
L2395: */
L2396: 
L2397: fontWeightBold?: FontWeight;
L2398: 
L2399: /**
L2400: 
L2401: * Whether to ignore the bracketed paste mode. When true, this will always
L2402: * paste without the `\x1b[200~` and `\x1b[201~` sequences, even when the
L2403: 
L2404: * shell enables bracketed mode.
L2405: 
L2406: */
L2407: 
L2408: ignoreBracketedPasteMode?: boolean;
L2409: 
L2410: /**
L2411: 
L2412: * The spacing in whole pixels between characters.
L2413: 
L2414: */
L2415: 
L2416: letterSpacing?: number;
L2417: 
L2418: /**
L2419: 
L2420: * The line height used to render text.
L2421: 
L2422: */
L2423: 
L2424: lineHeight?: number;
L2425: 
L2426: /**
L2427: 
L2428: * The handler for OSC 8 hyperlinks. Links will use the `confirm` browser
L2429: 
L2430: * API with a strongly worded warning if no link handler is set.
L2431: 
L2432: *
L2433: * When setting this, consider the security of users opening these links,
L2434: 
L2435: * at a minimum there should be a tooltip or a prompt when hovering or
L2436: 
L2437: * activating the link respectively. An example of what might be possible is
L2438: 
L2439: * a terminal app writing link in the form `javascript:...` …[truncated]</excerpt>
</source>
<source kind="search">
<title>xterm.js/typings/xterm.d.ts at master · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts</location>
<excerpt>citeturn0search0 [wordlim: 200] Crawled: 2 weeks ago; * Whether to reflow the line containing the cursor when the terminal is ... scrollback?: number; ... backend === &#39;conpty&#39; &amp;&amp; buildNumber &gt;= 21376)` ... windowsPty?: IWindowsPty; ... * [0]: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
* in but generally rejected in modern terminals.

*/

quirks?: ITerminalQuirks;

/**

* Whether to reflow the line containing the cursor when the terminal is

* resized. Defaults to false, because shells usually handle this

* themselves. Note that this will not move the cursor position, only the

* line contents.

*/

reflowCursorLine?: boolean;

/**

* Whether to rescale glyphs horizontally that are a single cell wide but

* have glyphs that would overlap following cell(s). This typically happens

* for ambiguous width characters (eg. the roman numeral characters U+2160+)

* which aren&#39;t featured in monospace fonts. This is an important feature

* for achieving GB18030 compliance.

*

* The following glyphs will never be rescaled:

*

* - Emoji glyphs

* - Powerline glyphs

* - Nerd font glyphs

*

* Note that this doesn&#39;t work with the DOM renderer. The default is false.

*/

rescaleOverlappingGlyphs?: boolean;

/**

* Whether to select the word under the cursor on right click, this is

* standard behavior in a lot of macOS applications.

*/

rightClickSelectsWord?: boolean;

/**

* Whether screen reader support is enabled. When on this will expose

* supporting elements in the DOM to support NVDA on Windows and VoiceOver

* on macOS.

*/

screenReaderMode?: boolean;

/**

* The amount of scrollback in the terminal. Scrollback is the amount of

* rows that are retained when lines are scrolled beyond the initial

* viewport. Defaults to 1000.

*/

scrollback?: number;

/**

* If enabled the Erase in Display All (ED2) escape sequence will push

* erased text to scrollback, instead of clearing only the viewport portion.

* This emulates PuTTY&#39;s default clear screen behavior.

*/

scrollOnEraseInDisplay?: boolean;

/**

* Whether to scroll to the bottom whenever there is some user input. The

* default is true.

*/

scrollOnUserInput?: boolean;

/**

* The scrolling speed multiplier used for adjusting normal scrolling speed.

*/

scrollSensitivity?: number;

/**

* Options for configuring the scrollbar.

*/

scrollbar?: IScrollbarOptions;

/**

* The duration to smoothly scroll between the origin and the target in

* milliseconds. Set to 0 to disable smooth scrolling and scroll instantly.

*/

smoothScrollDuration?: number;

/**

* The size of tab stops in the terminal.

*/

tabStopWidth?: number;

/**

* The color theme of the terminal.

*/

theme?: ITheme;

/**

* Enable various VT extensions.

*/

vtExtensions?: IVtExtensions;

/**

* Compatibility information when the pty is known to be hosted on Windows.

* Setting this will turn on certain heuristics/workarounds depending on the

* values:

*

* - `if (backend !== undefined || buildNumber !== undefined)`

* - When increasing the rows in the terminal, the amount increased into

* the scrollback. This is done because ConPTY does not behave like

* expect scrollback to come back into the viewport, instead it makes

* empty rows at of the viewport. Not having this behavior can result in

* missing data as the rows get replaced.

* - `if !(backend === &#39;conpty&#39; &amp;&amp; buildNumber &gt;= 21376)`

* - Reflow is disabled

* - Lines are assumed to be wrapped if the last character of the line is

* not whitespace.

*/

windowsPty?: IWindowsPty;

/**

* A string containing all characters that are considered word separated by

* the double click to select work logic.

*/

*/

colorSchemeQuery?: boolean;

}

/**

* Pty information for Windows.

*/

export interface IWindowsPty {

/**

* What pty emulation backend is being used.

*/

backend?: &#39;conpty&#39; | &#39;winpty…[truncated]</excerpt>
</source>
<source kind="search">
<title>IWindowsPty</title>
<location>https://xtermjs.org/docs/api/terminal/interfaces/iwindowspty/</location>
<excerpt>citeturn0search1 [wordlim: 200] Crawled: 6 months ago; # Interface: IWindowsPty ... • backend? : *“conpty”  | “winpty”*Defined in xterm.d.ts:425 ... ### `Optional` buildNumber
# Interface: IWindowsPty

Pty information for Windows.

## Properties

### `Optional` backend

• backend? : *“conpty”  | “winpty”*

Defined in xterm.d.ts:425

What pty emulation backend is being used.

* * *

### `Optional` buildNumber

• buildNumber? : number

Defined in xterm.d.ts:429

The Windows build version (eg. 19045)</excerpt>
</source>
<source kind="search">
<title>Releases · xtermjs/xterm.js · GitHub</title>
<location>https://github.com/xtermjs/xterm.js/releases</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: 2 days ago;   * #5321 Reflow on resize using similar logic to conpty ...   * #5130 Remove xterm- prefix from addon mjs output ... This commit was created on GitHub.com and signed with GitHub’s verified signature. ...         buildNumber: 19000 ...   * `windowsMode` has been deprecated in favor of `windowsPty` ...     term.setOption(&#39;scrollback&#39;, 1000);
  * #5379 Bump form-data from 4.0.0 to 4.0.4 in /addons/addon-ligatures
  * #5362 Move copilot steps to correct folder
  * #5359 Add copilot setup steps
  * #5358 Revert conpty-specific reflow handling
  * #5349 Add comprehensive tests for alt+shift+letter keyboard combinations
  * #5345 Add instructions to help Copilot coding agent
  * #5329 Update and pin esbuild
  * #5322 Bump axios from 1.7.4 to 1.8.2 in /addons/addon-ligatures
  * #5321 Reflow on resize using similar logic to conpty
  * #5317 docs: added usage tip for registerMarker()
  * #5313 Revert &quot;Merge pull request #5253 from akphi/patch-1&quot;
  * #5308 Update AccessibilityManager.ts to use textContent rather than innerText
  * #5290 Progress polish
  * #5286 Move WebGL addon-specific code into addon
  * #5281 Pin Ubuntu 22 to fix playwright GH Actions issue for now

## 5.2.0

5.2.0

Compare

# Choose a tag to compare

## Sorry, something went wrong.

Filter

Loading [Input]

## Sorry, something went wrong.

### Uh oh!

There was an error while loading. Please reload this page.

## No results found

View all tags

Image: @Tyriar Tyriar released this 08 Jun 22:01

5.2.0

`cc1089e`

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

GPG key ID: 4AEE18F83AFDEB23

Expired

Verified

Learn about vigilant mode.

## 🚀 Features

  * Support for the overline attribute SGR 53/55 (#4526, #4532) via @Tyriar

### 📦 API

  * Improved Windows workarounds with the new windowsPty option (#4539) via @Tyriar
    
    const term = new Terminal({
      windowsPty: {
        backend: &#39;conpty&#39;,
        buildNumber: 19000
      }
    });

## 🐞 Bug fixes
  * Update CI containers to use Node 18 (#4542) via @silamon
4542
  * Remove unused imports (#4361) via @Eugeny
  * Replace dom helper with HTMLElement.remove() (#4364) via @Tyriar
  * Show proper parameter hints when calling createInstance (#4393) via @Tyriar
  * Correct registerMarker API docs (#4464) via @Tyriar
  * Add FAQ to new issue report (#4512) via @Tyriar
  * Fix buffer corruption for utf8 transport in demo (#4527) via @jerch

## ⚠️ Deprecations

  * `windowsMode` has been deprecated in favor of `windowsPty`
    
    // Before 5.2
    term = new Terminal({ windowsMode: true });
    // After 5.2
    term = new Terminal({
      windowsPty: {
        backend: &#39;conpty&#39;,
        buildNumber: 19000
      }
    });

## 🎉 New real-world use cases

  * graSSHopper (#4356) via @Coding-Kiwi
  * DomTerm (#4456) via @Tyriar
</excerpt>
</source>
<source kind="search">
<title>Scrollback goes missing when resizing a conpty-based terminal · Issue #2459 · xtermjs/xterm.js · GitHub</title>
<location>GitHub issue 2459 in xtermjs/xterm.js (link omitted to avoid creating a cross-reference)</location>
<excerpt>citeturn0search3 [wordlim: 200] Published: 7.0 years ago; Crawled: 2 weeks ago;   1. xtermjs ... # Scrollback goes missing when resizing a conpty-based terminal #2459 ...      * Resize back to 26 rows - the 10 rows get pushed down into the viewport and then immediately get overwritten by conpty reprinting the screen

  1. xtermjs
  2. xterm.js


# Scrollback goes missing when resizing a conpty-based terminal #2459

New issue

Copy link

New issue

Copy link

Closed

#2476

Closed

Scrollback goes missing when resizing a conpty-based terminal#2459

#2476

Copy link

Assignees

Labels

platform/windowstype/bugSomething is misbehavingSomething is misbehaving

Milestone

4.2.0

## Description

Tyriar

opened on Oct 9, 2019

Issue body actions

VS Code issue: microsoft/vscode#78634

I think it&#39;s related to how we try to pull scrollback into the viewport when resizing upwards, but then conpty still draws its current state of the work. Maybe we should disable that in windows mode?

## Activity

  1. Tyriar

added

type/bugSomething is misbehavingSomething is misbehaving

platform/windows

on Oct 9, 2019

  2. Tyriar

added this to the 4.2.0 milestone on Oct 9, 2019

  3. Tyriar

self-assigned this

on Oct 9, 2019

  4. ### Tyriar commented on Oct 16, 2019

Tyriar

on Oct 16, 2019

Member Author

More actions

Repro:

     * Enable conpty ([email protected]+)
     * Open demo
     * Run dir
     * Resize to 16 rows (everything is fine)
     * Resize back to 26 rows - the 10 rows get pushed down into the viewport and then immediately get overwritten by conpty reprinting the screen

  5. Tyriar

added a commit that references this issue on Oct 16, 2019

Fix scrollback going missing when increase size on Windows

...

This issue will close once commit 843ea1b is merged into the &#39;master&#39; branch.

843ea1b

  6. Tyriar

closed this as completedin #2476on Oct 17, 2019

## Metadata

## Metadata

### Assignees

  * Tyriar

### Labels

platform/windowstype/bugSomething is misbehavingSomething is misbehaving

### Type

No type

### Projects

No projects

### Milestone

  * 4.2.0

### Relationships

None yet

### Development

No branches or pull requests</excerpt>
</source>
<omitted_sources count="26">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts
- 2: https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts
- 3: https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts

Resolve the resize model mismatch for WSL panes.

The daemon enables windowsPty for every non-POSIX owner backend, including windows-wsl. The renderer does not enable it for WSL panes. Its buildWindowsPtyCompatibilityOptions returns {} when the cwd is a WSL UNC path or the shell override launches wsl.exe. xterm's windowsPty typing says this option stops ConPTY-backed scrollback from being pulled back into the viewport when rows increase. A renderer without it can pull restored history into the viewport on a row increase, while the daemon snapshot keeps the ConPTY grid. The two views can then diverge for WSL panes, which is the mismatch this PR fixes.

Choose one resize model for WSL panes and apply it in both the daemon and the renderer. The renderer exclusion is covered by tests in windows-pty-compatibility.test.ts, so changing it also changes that contract. Confirm the intended WSL behavior before editing either side.

ConPTY's screen holds only what the shell wrote at its current height, so a
shrink drops the rows above the cursor and each resize repaints that screen.
Assert every restored and shell row appears once, in order, across shrink,
shrink-then-grow and grow-past-original heights.
@nwparker
nwparker merged commit 55d12e1 into main Oct 25, 2026
55 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