diff options
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r-- | compiler/utils/Outputable.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 403c5cef73..4107e5beef 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -723,19 +723,18 @@ ppUnless False doc = doc -- -- Only takes effect if colours are enabled. coloured :: Col.PprColour -> SDoc -> SDoc -coloured col@(Col.PprColour c) sdoc = +coloured col sdoc = sdocWithDynFlags $ \dflags -> if shouldUseColor dflags - then SDoc $ \ctx@SDC{ sdocLastColour = Col.PprColour lc } -> + then SDoc $ \ctx@SDC{ sdocLastColour = lastCol } -> case ctx of SDC{ sdocStyle = PprUser _ _ Coloured } -> - let ctx' = ctx{ sdocLastColour = col } in - Pretty.zeroWidthText (cReset ++ c) + let ctx' = ctx{ sdocLastColour = lastCol `mappend` col } in + Pretty.zeroWidthText (Col.renderColour col) Pretty.<> runSDoc sdoc ctx' - Pretty.<> Pretty.zeroWidthText (cReset ++ lc) + Pretty.<> Pretty.zeroWidthText (Col.renderColourAfresh lastCol) _ -> runSDoc sdoc ctx else sdoc - where Col.PprColour cReset = Col.colReset keyword :: SDoc -> SDoc keyword = coloured Col.colBold |