Skip to content

Commit a1968db

Browse files
committed
fix Ansi.res
1 parent d785144 commit a1968db

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

src/common/Ansi.res

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -182,34 +182,37 @@ module Lexer = {
182182
let groups = RegExp.Result.matches(result)
183183
switch groups[1] {
184184
| Some(str) =>
185-
switch String.split(str->Option.getUnsafe, ";") {
186-
| ["0"] => ClearSgr({loc, raw})
187-
| other =>
188-
let params = Array.map(other, s =>
189-
switch s {
190-
| "1" => Bold
191-
| "30" => Fg(Black)
192-
| "31" => Fg(Red)
193-
| "32" => Fg(Green)
194-
| "33" => Fg(Yellow)
195-
| "34" => Fg(Blue)
196-
| "35" => Fg(Magenta)
197-
| "36" => Fg(Cyan)
198-
| "37" => Fg(White)
199-
| "40" => Bg(Black)
200-
| "41" => Bg(Red)
201-
| "42" => Bg(Green)
202-
| "43" => Bg(Yellow)
203-
| "44" => Bg(Blue)
204-
| "45" => Bg(Magenta)
205-
| "46" => Bg(Cyan)
206-
| "47" => Bg(White)
207-
| o => Unknown(o)
208-
}
209-
)
210-
Sgr({loc, raw, params})
185+
switch str {
186+
| Some(str) =>
187+
switch String.split(str, ";") {
188+
| ["0"] => ClearSgr({loc, raw})
189+
| other =>
190+
let params = Array.map(other, s =>
191+
switch s {
192+
| "1" => Bold
193+
| "30" => Fg(Black)
194+
| "31" => Fg(Red)
195+
| "32" => Fg(Green)
196+
| "33" => Fg(Yellow)
197+
| "34" => Fg(Blue)
198+
| "35" => Fg(Magenta)
199+
| "36" => Fg(Cyan)
200+
| "37" => Fg(White)
201+
| "40" => Bg(Black)
202+
| "41" => Bg(Red)
203+
| "42" => Bg(Green)
204+
| "43" => Bg(Yellow)
205+
| "44" => Bg(Blue)
206+
| "45" => Bg(Magenta)
207+
| "46" => Bg(Cyan)
208+
| "47" => Bg(White)
209+
| o => Unknown(o)
210+
}
211+
)
212+
Sgr({loc, raw, params})
213+
}
214+
| None => Sgr({loc, raw, params: []})
211215
}
212-
213216
| None => Sgr({loc, raw, params: []})
214217
}
215218
| None => Sgr({loc, raw, params: []})

0 commit comments

Comments
 (0)