@@ -106,110 +106,61 @@ module internal Utils =
106106
107107 /// An array stores ranges of full-width chars.
108108 ///
109- /// Array [| a; b; c; d |] represents range [a, b] or [c, d], means chars in these ranges are full-width.
109+ /// Array [| [| a; b |]; [| c; d |] |] represents range [a, b] or [c, d], means chars in these ranges are full-width.
110110 let private fullWidthCharRanges =
111- [|
112- '\u1100'
113- '\u115f'
114- '\u231a'
115- '\u231b'
116- '\u2329'
117- '\u232a'
118- '\u23e9'
119- '\u23ec'
120- '\u23f0'
121- '\u23f0'
122- '\u23f3'
123- '\u23f3'
124- '\u25fd'
125- '\u25fe'
126- '\u2614'
127- '\u2615'
128- '\u2648'
129- '\u2653'
130- '\u267f'
131- '\u267f'
132- '\u2693'
133- '\u2693'
134- '\u26a1'
135- '\u26a1'
136- '\u26aa'
137- '\u26ab'
138- '\u26bd'
139- '\u26be'
140- '\u26c4'
141- '\u26c5'
142- '\u26ce'
143- '\u26ce'
144- '\u26d4'
145- '\u26d4'
146- '\u26ea'
147- '\u26ea'
148- '\u26f2'
149- '\u26f3'
150- '\u26f5'
151- '\u26f5'
152- '\u26fa'
153- '\u26fa'
154- '\u26fd'
155- '\u26fd'
156- '\u2705'
157- '\u2705'
158- '\u270a'
159- '\u270b'
160- '\u2728'
161- '\u2728'
162- '\u274c'
163- '\u274c'
164- '\u274e'
165- '\u274e'
166- '\u2753'
167- '\u2755'
168- '\u2757'
169- '\u2757'
170- '\u2795'
171- '\u2797'
172- '\u27b0'
173- '\u27b0'
174- '\u27bf'
175- '\u27bf'
176- '\u2b1b'
177- '\u2b1c'
178- '\u2b50'
179- '\u2b50'
180- '\u2b55'
181- '\u2b55'
182- '\u2e80'
183- '\u303e'
184- '\u3041'
185- '\u3096'
186- '\u3099'
187- '\u30ff'
188- '\u3105'
189- '\u312f'
190- '\u3131'
191- '\u318e'
192- '\u3190'
193- '\u3247'
194- '\u3250'
195- '\u4dbf'
196- '\u4e00'
197- '\ua4c6'
198- '\ua960'
199- '\ua97c'
200- '\uac00'
201- '\ud7a3'
202- '\uf900'
203- '\ufaff'
204- '\ufe10'
205- '\ufe1f'
206- '\ufe30'
207- '\ufe6b'
208- '\uff01'
209- '\uff60'
210- '\uffe0'
211- '\uffe6'
212- |]
111+ Array.concat
112+ [|
113+ [| '\u1100'; '\u115f' |]
114+ [| '\u231a'; '\u231b' |]
115+ [| '\u2329'; '\u232a' |]
116+ [| '\u23e9'; '\u23ec' |]
117+ [| '\u23f0'; '\u23f0' |]
118+ [| '\u23f3'; '\u23f3' |]
119+ [| '\u25fd'; '\u25fe' |]
120+ [| '\u2614'; '\u2615' |]
121+ [| '\u2648'; '\u2653' |]
122+ [| '\u267f'; '\u267f' |]
123+ [| '\u2693'; '\u2693' |]
124+ [| '\u26a1'; '\u26a1' |]
125+ [| '\u26aa'; '\u26ab' |]
126+ [| '\u26bd'; '\u26be' |]
127+ [| '\u26c4'; '\u26c5' |]
128+ [| '\u26ce'; '\u26ce' |]
129+ [| '\u26d4'; '\u26d4' |]
130+ [| '\u26ea'; '\u26ea' |]
131+ [| '\u26f2'; '\u26f3' |]
132+ [| '\u26f5'; '\u26f5' |]
133+ [| '\u26fa'; '\u26fa' |]
134+ [| '\u26fd'; '\u26fd' |]
135+ [| '\u2705'; '\u2705' |]
136+ [| '\u270a'; '\u270b' |]
137+ [| '\u2728'; '\u2728' |]
138+ [| '\u274c'; '\u274c' |]
139+ [| '\u274e'; '\u274e' |]
140+ [| '\u2753'; '\u2755' |]
141+ [| '\u2757'; '\u2757' |]
142+ [| '\u2795'; '\u2797' |]
143+ [| '\u27b0'; '\u27b0' |]
144+ [| '\u27bf'; '\u27bf' |]
145+ [| '\u2b1b'; '\u2b1c' |]
146+ [| '\u2b50'; '\u2b50' |]
147+ [| '\u2b55'; '\u2b55' |]
148+ [| '\u2e80'; '\u303e' |]
149+ [| '\u3041'; '\u3096' |]
150+ [| '\u3099'; '\u30ff' |]
151+ [| '\u3105'; '\u312f' |]
152+ [| '\u3131'; '\u318e' |]
153+ [| '\u3190'; '\u3247' |]
154+ [| '\u3250'; '\u4dbf' |]
155+ [| '\u4e00'; '\ua4c6' |]
156+ [| '\ua960'; '\ua97c' |]
157+ [| '\uac00'; '\ud7a3' |]
158+ [| '\uf900'; '\ufaff' |]
159+ [| '\ufe10'; '\ufe1f' |]
160+ [| '\ufe30'; '\ufe6b' |]
161+ [| '\uff01'; '\uff60' |]
162+ [| '\uffe0'; '\uffe6' |]
163+ |]
213164
214165 let isFullWidth ( char ) =
215166 // for array [| a; b; c; d |],
@@ -253,10 +204,6 @@ type internal Anchor =
253204
254205 member p.PlaceAt ( inset , index ) =
255206 //printf "p.top = %d, p.left = %d, inset = %d, index = %d\n" p.top p.left inset index
256- //let left = inset + (((p.left - inset) + index) % (Console.BufferWidth - inset))
257- //let top = p.top + ((p.left - inset) + index) / (Console.BufferWidth - inset)
258-
259- // don't write char to the last 2 column
260207 let width = Utils.bufferWidth ()
261208 let index = inset + index
262209
@@ -379,18 +326,8 @@ type internal ReadLineConsole() =
379326 let writeBlank () =
380327 moveCursorToNextLine ( ' ' )
381328 Console.Write( ' ' )
382- //checkLeftEdge false
383329
384330 let writeChar ( c ) =
385- //if
386- // Console.CursorTop = Console.BufferHeight - 1
387- // && Console.CursorLeft = Console.BufferWidth - 1
388- //then
389- // //printf "bottom right!\n"
390- // anchor <- { anchor with top = (anchor).top - 1 }
391-
392- //checkLeftEdge true
393-
394331 moveCursorToNextLine ( c)
395332
396333 if Char.IsControl( c) then
@@ -401,36 +338,16 @@ type internal ReadLineConsole() =
401338 Console.Write( c)
402339 rendered <- rendered + x.GetCharacterSize( c)
403340
404- //checkLeftEdge true
405-
406341 /// The console input buffer.
407342 let input = new StringBuilder()
408343
409344 /// Current position - index into the input buffer
410345 let mutable current = 0
411346
412347 let render () =
413- //printf "render\n"
414348 let curr = current
415349 anchor.PlaceAt( x.Inset, 0 )
416350
417- // let output = new StringBuilder()
418- // let mutable position = -1
419-
420- // for i = 0 to input.Length - 1 do
421- // if (i = curr) then
422- // position <- output.Length
423-
424- // let c = input.Chars(i)
425-
426- // if (Char.IsControl c) then
427- // output.Append(x.MapCharacter c) |> ignore
428- // else
429- // output.Append(c) |> ignore
430-
431- // if (curr = input.Length) then
432- // position <- output.Length
433-
434351 let rec getLineWidth state i =
435352 if i = curr || i = input.Length then
436353 state
0 commit comments