diff options
-rw-r--r-- | blessings.cabal | 2 | ||||
-rw-r--r-- | src/Blessings.hs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/blessings.cabal b/blessings.cabal index e8be029..e5b0c7d 100644 --- a/blessings.cabal +++ b/blessings.cabal @@ -3,7 +3,7 @@ build-type: Simple cabal-version: >= 1.2 license: MIT name: blessings -version: 2.0.0 +version: 2.1.0 library build-depends: diff --git a/src/Blessings.hs b/src/Blessings.hs index 21cbabd..302b8bc 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -251,6 +251,14 @@ renderSGR pm = ("\ESC["<>) . (<>"m") . Bless.intercalate ";" . map Bless.fromInt $ pm +stripSGR :: Blessings a -> Blessings a +stripSGR = \case + Append t1 t2 -> Append (stripSGR t1) (stripSGR t2) + SGR _ t -> stripSGR t + Plain x -> Plain x + Empty -> Empty + + pp :: (Blessable a) => Blessings a -> a pp t = render emptyRenderState t "" |