diff options
author | Phil Ruffwind <rf@rufflewind.com> | 2017-05-22 12:00:34 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-22 12:41:20 -0400 |
commit | 139ef04bdbd14b74dd6202295e11a37295442fc8 (patch) | |
tree | fe4bcac54572dda10616fc9dfa9e6a0ce7c30cb1 /compiler/utils/Outputable.hs | |
parent | dac49bdc79387ca9f91c7c5c9220699efb6239fb (diff) | |
download | haskell-139ef04bdbd14b74dd6202295e11a37295442fc8.tar.gz |
Add "header" to GHC_COLORS
Add "header" to GHC_COLORS and allow colors to be inherited from the
surroundings.
Test Plan: validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13718
Differential Revision: https://phabricator.haskell.org/D3599
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 |