From 307e0fd354e0b4a251fa558481a4378b5794a391 Mon Sep 17 00:00:00 2001 From: Lukasz Stafiniak Date: Sun, 21 Jan 2024 08:41:57 +0100 Subject: [PATCH] PrintBox.ml: shouldn't Text store a list of non-breakable lines? 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. --- src/PrintBox.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PrintBox.ml b/src/PrintBox.ml index 553a986..f8fb027 100644 --- a/src/PrintBox.ml +++ b/src/PrintBox.ml @@ -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