Skip to content

Commit

Permalink
Handle 39 correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Mar 29, 2021
1 parent 828dc01 commit 3bdde29
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 417 deletions.
21 changes: 21 additions & 0 deletions otherlibs/stdune-unstable/ansi_color.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ module Style = struct

let fg_bright_white = "97"

let fg_all =
[ fg_black
; fg_green
; fg_yellow
; fg_blue
; fg_magenta
; fg_cyan
; fg_white
; fg_bright_black
; fg_bright_red
; fg_bright_green
; fg_bright_yellow
; fg_bright_blue
; fg_bright_magenta
; fg_bright_cyan
; fg_bright_white
]

let bg_black = "40"

let bg_red = "41"
Expand Down Expand Up @@ -181,6 +199,9 @@ let parse_line str styles =
|> String.split ~on:';'
|> List.fold_left ~init:(List.rev styles) ~f:(fun styles s ->
match s with
| "39" ->
List.filter styles ~f:(fun s ->
not (List.mem Style.fg_all s ~equal:String.equal))
| "0" -> []
| _ -> s :: styles)
|> List.rev
Expand Down
Loading

0 comments on commit 3bdde29

Please sign in to comment.