Skip to content

Commit

Permalink
Fix missing newline in open question edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvee1 committed Feb 16, 2021
1 parent 35a0273 commit d3f130b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/UI/Cards.hs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ wrapStringWithPadding padding w s
let startsWithSpace = head s == ' '
s' = if startsWithSpace then " " <> replicate padding 'X' <> tail s else replicate padding 'X' ++ s
lastLetter = last s
prefix = if head s `elem` ['\n', '\r'] then T.pack " " else T.empty
postfix = if lastLetter == ' ' then T.pack [lastLetter] else T.empty
ts = wrapTextToLines wrapSettings w (pack s') & ix 0 %~ (if startsWithSpace then (T.pack " " `T.append`) . T.drop (padding + 1) else T.drop padding)
ts' = ts & _last %~ (`T.append` postfix)
ts' = prefix : (ts & _last %~ (`T.append` postfix))
padding' = textWidth (last ts') + (if length ts' == 1 then 1 else 0) * padding in
(map txt (filter (/=T.empty) ts'), padding', True)
else
Expand Down

0 comments on commit d3f130b

Please sign in to comment.