summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-25 13:55:35 +0100
committertv <tv@krebsco.de>2019-01-25 13:56:48 +0100
commite75d0cf94582a5aa6dde781b8428ffff45cf7e76 (patch)
treee53cecef284df4082296b56e7562f70eb2ed10b7 /src
parent6b767df2fc47a77a4f856e040346ce49c0e7bf00 (diff)
Blessings: add stripSGRv2.1.0
Diffstat (limited to 'src')
-rw-r--r--src/Blessings.hs8
1 files changed, 8 insertions, 0 deletions
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 ""