File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,26 @@ type char_info = {
138
138
ci_background : int ;
139
139
}
140
140
141
- external write_console_output : Unix .file_descr -> char_info array array -> LTerm_geom .size -> LTerm_geom .coord -> LTerm_geom .rect -> LTerm_geom .rect = " lt_windows_write_console_output"
141
+ type char_info_raw = {
142
+ cir_char : UChar .t ;
143
+ cir_foreground : int ;
144
+ cir_background : int ;
145
+ }
146
+
147
+ let char_info_to_raw ci =
148
+ Zed_char. to_array ci.ci_char
149
+ |> Array. map (fun char ->
150
+ { cir_char= char ;
151
+ cir_foreground= ci.ci_foreground;
152
+ cir_background= ci.ci_background
153
+ })
154
+
155
+ external write_console_output : Unix .file_descr -> char_info_raw array array -> LTerm_geom .size -> LTerm_geom .coord -> LTerm_geom .rect -> LTerm_geom .rect = " lt_windows_write_console_output"
156
+
157
+ let chars_to_raw chars =
158
+ Array. map
159
+ (fun line -> List. map (fun ci -> char_info_to_raw ci) (Array. to_list line) |> Array. concat)
160
+ chars
142
161
143
162
let write_console_output fd chars size coord rect =
144
163
Lwt_unix. check_descriptor fd;
@@ -147,6 +166,7 @@ let write_console_output fd chars size coord rect =
147
166
(fun line ->
148
167
if Array. length line <> size.LTerm_geom. cols then invalid_arg " LTerm_windows.write_console_output" )
149
168
chars;
169
+ let chars= chars_to_raw chars in
150
170
write_console_output (Lwt_unix. unix_file_descr fd) chars size coord rect
151
171
152
172
external fill_console_output_character : Unix .file_descr -> UChar .t -> int -> LTerm_geom .coord -> int = " lt_windows_fill_console_output_character"
You can’t perform that action at this time.
0 commit comments