@@ -38,71 +38,6 @@ export interface ElementInfo {
3838 bounds : BoundingBox ;
3939}
4040
41- const WINDOWS_WRAP_DISABLE = new Uint8Array ( [ 0x1b , 0x5b , 0x3f , 0x37 , 0x6c ] ) ;
42- const WINDOWS_WRAP_ENABLE = new Uint8Array ( [ 0x1b , 0x5b , 0x3f , 0x37 , 0x68 ] ) ;
43-
44- function windowsFullscreenHandlingDisabled ( ) : boolean {
45- let diagnostics = ( globalThis as typeof globalThis & {
46- __claytermDiagnostics__ ?: {
47- disableWindowsFullscreenHandling ?: boolean ;
48- } ;
49- } ) . __claytermDiagnostics__ ;
50-
51- return diagnostics ?. disableWindowsFullscreenHandling === true ;
52- }
53-
54- function normalizeWindowsLineOutput ( output : Uint8Array ) : Uint8Array {
55- // Empirically, Deno-on-Windows fullscreen redraws were more reliable when
56- // line-mode output began with a home cursor move and used CRLF row
57- // separators. Bare LF left later rows visually clipped in the tested
58- // terminal stack, while localized redraws could still reveal the content.
59- let extra = 0 ;
60- for ( let i = 0 ; i < output . length ; i ++ ) {
61- if ( output [ i ] === 0x0a && ( i === 0 || output [ i - 1 ] !== 0x0d ) ) {
62- extra ++ ;
63- }
64- }
65-
66- let prefix = new Uint8Array ( [
67- ...WINDOWS_WRAP_DISABLE ,
68- 0x1b ,
69- 0x5b ,
70- 0x48 ,
71- ] ) ;
72- let suffix = WINDOWS_WRAP_ENABLE ;
73- let normalized = new Uint8Array (
74- prefix . length + output . length + extra + suffix . length ,
75- ) ;
76- normalized . set ( prefix , 0 ) ;
77-
78- let offset = prefix . length ;
79- for ( let i = 0 ; i < output . length ; i ++ ) {
80- let byte = output [ i ] ;
81- if ( byte === 0x0a && ( i === 0 || output [ i - 1 ] !== 0x0d ) ) {
82- normalized [ offset ++ ] = 0x0d ;
83- }
84- normalized [ offset ++ ] = byte ;
85- }
86-
87- normalized . set ( suffix , offset ) ;
88-
89- return normalized as Uint8Array ;
90- }
91-
92- function wrapWindowsFullscreenOutput ( output : Uint8Array ) : Uint8Array {
93- // Preserve an explicit wrap-state boundary around fullscreen frames on
94- // Windows. In the tested Deno path this avoided redraw glitches at the right
95- // edge even though the same scene rendered cleanly in Node.
96- // xterm defines CSI ? 7 h / CSI ? 7 l as auto-wrap on/off.
97- let wrapped = new Uint8Array (
98- WINDOWS_WRAP_DISABLE . length + output . length + WINDOWS_WRAP_ENABLE . length ,
99- ) ;
100- wrapped . set ( WINDOWS_WRAP_DISABLE , 0 ) ;
101- wrapped . set ( output , WINDOWS_WRAP_DISABLE . length ) ;
102- wrapped . set ( WINDOWS_WRAP_ENABLE , WINDOWS_WRAP_DISABLE . length + output . length ) ;
103- return wrapped ;
104- }
105-
10641const ERROR_TYPES = [
10742 "TEXT_MEASUREMENT_FUNCTION_NOT_PROVIDED" ,
10843 "ARENA_CAPACITY_EXCEEDED" ,
@@ -135,10 +70,6 @@ export interface Term {
13570 render ( ops : Op [ ] , options ?: RenderOptions ) : RenderResult ;
13671}
13772
138- let runtimeIsWindows = ( globalThis as typeof globalThis & {
139- Deno ?: { build ?: { os ?: string } } ;
140- } ) . Deno ?. build ?. os === "windows" ;
141-
14273export async function createTerm ( options : TermOptions ) : Promise < Term > {
14374 let { width, height } = options ;
14475 let native = await createTermNative ( width , height ) ;
@@ -153,18 +84,6 @@ export async function createTerm(options: TermOptions): Promise<Term> {
15384 let len = pack ( ops , memory . buffer , opsBuf , memory . buffer . byteLength ) ;
15485 let mode = options ?. mode === "line" ? 1 : 0 ;
15586 let row = options ?. row ?? 1 ;
156- let autoLineMode = false ;
157- let windowsFullscreen = row === 1 && runtimeIsWindows &&
158- ! windowsFullscreenHandlingDisabled ( ) ;
159-
160- // Use the line-oriented render path by default for Windows fullscreen
161- // renders. This was required for Deno to avoid
162- // clipped rows during fullscreen redraw, while the equivalent Node path
163- // did not show the same failure.
164- if ( mode === 0 && options ?. mode === undefined && windowsFullscreen ) {
165- mode = 1 ;
166- autoLineMode = true ;
167- }
16887
16988 native . reduce ( statePtr , opsBuf , len , mode , row ) ;
17089
@@ -179,12 +98,6 @@ export async function createTerm(options: TermOptions): Promise<Term> {
17998 native . length ( statePtr ) ,
18099 ) ;
181100
182- if ( autoLineMode ) {
183- output = normalizeWindowsLineOutput ( output ) ;
184- } else if ( windowsFullscreen ) {
185- output = wrapWindowsFullscreenOutput ( output ) ;
186- }
187-
188101 let current = new Set (
189102 options ?. pointer ? native . getPointerOverIds ( ) : [ ] ,
190103 ) ;
0 commit comments