Skip to content

Commit

Permalink
PrintBox.ml: shouldn't Text store a list of non-breakable lines?
Browse files Browse the repository at this point in the history
Currently `PrintBox_text` does not assume that and splits each of the lines. But we have `PrintBox.line` and `PrintBox.lines`. The former validates the input, the latter does not.
  • Loading branch information
lukstafi authored and c-cube committed Jan 27, 2024
1 parent ba34cb7 commit 307e0fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PrintBox.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ let line_with_style style s =

let line s = line_with_style Style.default s

let text s = Text {l=[s]; style=Style.default}
let text_with_style style s = Text {l=[s]; style}
(* FIXME: does not handle '\r' *)
let text s = Text {l=String.split_on_char '\n' s; style=Style.default}
let text_with_style style s = Text {l=String.split_on_char '\n' s; style}

let sprintf_with_style style format =
let buffer = Buffer.create 64 in
Expand Down

0 comments on commit 307e0fd

Please sign in to comment.