prettyprinter-ansi-terminal 1.1.1.1 → 1.1.1.2
raw patch · 3 files changed
+20/−11 lines, 3 files
Files
- CHANGELOG.md +5/−0
- prettyprinter-ansi-terminal.cabal +3/−3
- src/Data/Text/Prettyprint/Doc/Render/Terminal/Internal.hs +12/−8
CHANGELOG.md view
@@ -1,3 +1,8 @@+# 1.1.1.2++- Fix documentation claiming there would be a trailing newline in `renderIO`+ when there is none+ # 1.1.1.1 - `renderIO` now renders directly to STDOUT, instead of first building a textual
prettyprinter-ansi-terminal.cabal view
@@ -1,5 +1,5 @@ name: prettyprinter-ansi-terminal-version: 1.1.1.1+version: 1.1.1.2 cabal-version: >= 1.10 category: User Interfaces, Text synopsis: ANSI terminal backend for the »prettyprinter« package.@@ -37,11 +37,11 @@ base >= 4.7 && < 5 , ansi-terminal >= 0.4.0 , text >= 1.2- , prettyprinter >= 1+ , prettyprinter >= 1.1.1 if impl(ghc >= 8.0) ghc-options: -Wcompat- if impl(ghc < 8.0)+ if !impl(ghc >= 8.0) build-depends: semigroups >= 0.1 test-suite doctest
src/Data/Text/Prettyprint/Doc/Render/Terminal/Internal.hs view
@@ -111,10 +111,10 @@ let push x = modifySTRef' styleStackRef (x :) unsafePeek = readSTRef styleStackRef >>= \case- [] -> panicPeekedEmpty+ [] -> panicPeekedEmpty x:_ -> pure x unsafePop = readSTRef styleStackRef >>= \case- [] -> panicPeekedEmpty+ [] -> panicPeekedEmpty x:xs -> writeSTRef styleStackRef xs >> pure x writeOutput x = modifySTRef outputRef (<> x) @@ -162,7 +162,7 @@ -- This function behaves just like -- -- @--- 'renderIO' h sdoc = 'TL.hPutStrLn' h ('renderLazy' sdoc)+-- 'renderIO' h sdoc = 'TL.hPutStr' h ('renderLazy' sdoc) -- @ -- -- but will not generate any intermediate text, rendering directly to the@@ -232,9 +232,9 @@ -- -- \ESC[0;91mred \ESC[0;94;4mblue+u \ESC[0;94;1;4mbold\ESC[0;94;4m blue+u\ESC[0;91m -- -- red\ESC[0m --- | Begin rendering in a certain style. Instead of using this type directly,--- consider using the 'Semigroup' instance to create new styles out of the smart--- constructors, such as+-- | Render the annotated document in a certain style. Styles not set in the+-- annotation will use the style of the surrounding document, or the terminal’s+-- default if none has been set yet. -- -- @ -- style = 'color' 'Green' '<>' 'bold'@@ -249,7 +249,8 @@ } deriving (Eq, Ord, Show) -- | Keep the first decision for each of foreground color, background color,--- boldness, italication, and underlining.+-- boldness, italication, and underlining. If a certain style is not set, the+-- terminal’s default will be used. -- -- Example: --@@ -257,7 +258,8 @@ -- 'color' 'Red' '<>' 'color' 'Green' -- @ ----- is red.+-- is red because the first color wins, and not bold because (or if) that’s the+-- terminal’s default. instance Semigroup AnsiStyle where cs1 <> cs2 = SetAnsiStyle { ansiForeground = ansiForeground cs1 <|> ansiForeground cs2@@ -266,6 +268,8 @@ , ansiItalics = ansiItalics cs1 <|> ansiItalics cs2 , ansiUnderlining = ansiUnderlining cs1 <|> ansiUnderlining cs2 } +-- | 'mempty' does nothing, which is equivalent to inheriting the style of the+-- surrounding doc, or the terminal’s default if no style has been set yet. instance Monoid AnsiStyle where mempty = SetAnsiStyle Nothing Nothing Nothing Nothing Nothing mappend = (<>)