From 83de76b67a9a9ca8eb1e39af8ebcb60357a22777 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 18 May 2023 06:23:35 -1000 Subject: [PATCH] lib: Hledger.Utils.IO: avoid excessively wide "compact" prettyprinting --- hledger-lib/Hledger/Utils/IO.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hledger-lib/Hledger/Utils/IO.hs b/hledger-lib/Hledger/Utils/IO.hs index 6fc6bd5e4..5f3fea1fe 100644 --- a/hledger-lib/Hledger/Utils/IO.hs +++ b/hledger-lib/Hledger/Utils/IO.hs @@ -126,18 +126,20 @@ import Hledger.Utils.Text (WideBuilder(WideBuilder)) -- Pretty showing/printing with pretty-simple +-- https://hackage.haskell.org/package/pretty-simple/docs/Text-Pretty-Simple.html#t:OutputOptions + -- | pretty-simple options with colour enabled if allowed. prettyopts = (if useColorOnStderr then defaultOutputOptionsDarkBg else defaultOutputOptionsNoColor) - { outputOptionsIndentAmount=2 - , outputOptionsCompact=True + { outputOptionsIndentAmount = 2 + -- , outputOptionsCompact = True -- fills lines, but does not respect page width (https://github.com/cdepillabout/pretty-simple/issues/126) + -- , outputOptionsPageWidth = fromMaybe 80 $ unsafePerformIO getTerminalWidth } -- | pretty-simple options with colour disabled. prettyopts' = defaultOutputOptionsNoColor { outputOptionsIndentAmount=2 - , outputOptionsCompact=True } -- | Pretty show. Easier alias for pretty-simple's pShow.