Skip to content

Commit deb91b8

Browse files
chshershqexat
andauthored
[#39] Move to Ansifmt (#46)
* Move to Ansifmt * Make Ansifmt a normal dependency Ansifmt 0.2.0 was just released, so we can pull it from the opam repository directly. --------- Co-authored-by: Qexat <43090614+qexat@users.noreply.github.com>
1 parent acd0d60 commit deb91b8

File tree

25 files changed

+74
-128
lines changed

25 files changed

+74
-128
lines changed

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
(depends
2020
(ocaml (>= "5.1"))
2121
dune
22-
(ANSITerminal (>= "0.8.5"))
22+
(ansifmt (>= "0.2.0"))
2323
(cmdliner (>= "1.2.0"))
2424
(ezcurl (>= "0.2.4"))
2525
shape-the-term

github_tui.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bug-reports: "https://github.com/chshersh/github-tui/issues"
1111
depends: [
1212
"ocaml" {>= "5.1"}
1313
"dune" {>= "3.12"}
14-
"ANSITerminal" {>= "0.8.5"}
14+
"ansifmt" {>= "0.2.0"}
1515
"cmdliner" {>= "1.2.0"}
1616
"ezcurl" {>= "0.2.4"}
1717
"shape-the-term"

lib/pretty/chunk.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ type t = {
33
string : string;
44
}
55

6-
let fmt { styles; string } = ANSITerminal.sprintf styles "%s" string
6+
let fmt { styles; string } = Ansifmt.Styling.wrap ~contents:string styles
77

88
let replicate width s =
9-
if width <= 0 then { styles = []; string = "" }
9+
let styles = Style.none in
10+
if width <= 0 then { styles; string = "" }
1011
else
1112
let filling = Extra.String.repeat_txt width s in
12-
{ styles = []; string = filling }
13+
{ styles; string = filling }

lib/pretty/color.ml

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/pretty/color.mli

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/pretty/doc.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type t =
77
| Horizontal of t list
88
| With_size of (width:int -> height:int -> t)
99

10-
let str string = Str ([], string)
10+
let str string = Str (Style.none, string)
1111
let fmt styles string = Str (styles, string)
1212
let horizontal cols = Horizontal cols
1313
let vertical rows = Vertical rows

lib/pretty/doc.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module Style = Style
2-
31
(** A type representing a structured document. *)
42
type t
53

lib/pretty/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(library
22
(name pretty)
33
(libraries
4-
ANSITerminal
4+
ansifmt
55
shell
66
;; Internal dependencies
77
extra))

lib/pretty/layout.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let height { height; _ } = height
1717
let str string =
1818
let width = Extra.String.width string in
1919
let height = 1 in
20-
let node = Str ([], string) in
20+
let node = Str (Style.none, string) in
2121
{ width; height; node }
2222

2323
let fmt styles string =

lib/pretty/layout.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module Style = Style
2-
31
(** A type representing a structured document with known sizes for all
42
sub-elements. *)
53
type t

0 commit comments

Comments
 (0)