···4141const WINDOWS_WRAP_DISABLE = new Uint8Array([0x1b, 0x5b, 0x3f, 0x37, 0x6c]);
4242const WINDOWS_WRAP_ENABLE = new Uint8Array([0x1b, 0x5b, 0x3f, 0x37, 0x68]);
43434444+function windowsFullscreenHandlingDisabled(): boolean {
4545+ let diagnostics = (globalThis as typeof globalThis & {
4646+ __claytermDiagnostics__?: {
4747+ disableWindowsFullscreenHandling?: boolean;
4848+ };
4949+ }).__claytermDiagnostics__;
5050+5151+ return diagnostics?.disableWindowsFullscreenHandling === true;
5252+}
5353+4454function normalizeWindowsLineOutput(output: Uint8Array): Uint8Array {
4545- // Windows fullscreen line-mode output needs an explicit home cursor move and
4646- // CRLF row separators; bare LF can leave the cursor in the wrong column and
4747- // visually clip later rows in some terminal stacks.
5555+ // Empirically, Deno-on-Windows fullscreen redraws were more reliable when
5656+ // line-mode output began with a home cursor move and used CRLF row
5757+ // separators. Bare LF left later rows visually clipped in the tested
5858+ // terminal stack, while localized redraws could still reveal the content.
4859 let extra = 0;
4960 for (let i = 0; i < output.length; i++) {
5061 if (output[i] === 0x0a && (i === 0 || output[i - 1] !== 0x0d)) {
···7990}
80918192function wrapWindowsFullscreenOutput(output: Uint8Array): Uint8Array {
8282- // Disabling autowrap around a fullscreen frame avoids Windows terminal
8383- // redraw quirks observed at the right edge.
9393+ // Preserve an explicit wrap-state boundary around fullscreen frames on
9494+ // Windows. In the tested Deno path this avoided redraw glitches at the right
9595+ // edge even though the same scene rendered cleanly in Node.
8496 // xterm defines CSI ? 7 h / CSI ? 7 l as auto-wrap on/off.
8597 let wrapped = new Uint8Array(
8698 WINDOWS_WRAP_DISABLE.length + output.length + WINDOWS_WRAP_ENABLE.length,
···123135 render(ops: Op[], options?: RenderOptions): RenderResult;
124136}
125137138138+let runtimeIsWindows = (globalThis as typeof globalThis & {
139139+ Deno?: { build?: { os?: string } };
140140+}).Deno?.build?.os === "windows";
141141+126142export async function createTerm(options: TermOptions): Promise<Term> {
127143 let { width, height } = options;
128144 let native = await createTermNative(width, height);
···138154 let mode = options?.mode === "line" ? 1 : 0;
139155 let row = options?.row ?? 1;
140156 let autoLineMode = false;
141141- let windowsFullscreen = row === 1 && Deno.build.os === "windows";
157157+ let windowsFullscreen = row === 1 && runtimeIsWindows &&
158158+ !windowsFullscreenHandlingDisabled();
142159143143- // Windows terminals have historically been less reliable with many
144144- // absolute cursor CUP updates in full-screen diff mode. Use the
145145- // line-oriented render path by default on Windows for fullscreen
146146- // layouts to improve redraw reliability.
160160+ // Use the line-oriented render path by default for Windows fullscreen
161161+ // renders. This was required for Deno to avoid
162162+ // clipped rows during fullscreen redraw, while the equivalent Node path
163163+ // did not show the same failure.
147164 if (mode === 0 && options?.mode === undefined && windowsFullscreen) {
148165 mode = 1;
149166 autoLineMode = true;