mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-12-12 12:23:21 +03:00
str: right-pad short lines in multi-line text strings
This commit is contained in:
parent
19221e6a6f
commit
df28848f3f
@ -219,7 +219,11 @@ str s =
|
||||
-- behavior of empty strings (they have imageHeight 1)
|
||||
[] -> return $ def & image .~ (V.string (c^.attr) "")
|
||||
[one] -> return $ def & image .~ (V.string (c^.attr) one)
|
||||
multiple -> return $ def & image .~ (V.vertCat $ V.string (c^.attr) <$> multiple)
|
||||
multiple ->
|
||||
let maxLength = maximum $ length <$> multiple
|
||||
lineImgs = lineImg <$> multiple
|
||||
lineImg lStr = V.string (c^.attr) (lStr ++ replicate (maxLength - length lStr) ' ')
|
||||
in return $ def & image .~ (V.vertCat lineImgs)
|
||||
|
||||
txt :: T.Text -> Widget
|
||||
txt = str . T.unpack
|
||||
|
Loading…
Reference in New Issue
Block a user