]> gitweb.factorcode.org Git - factor.git/commitdiff
io.streams.ansi: simplify
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 29 Jan 2023 01:47:07 +0000 (17:47 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 29 Jan 2023 01:47:07 +0000 (17:47 -0800)
extra/io/streams/ansi/ansi.factor

index f2eb66fc2bc5b431838ba4b30b4b4ca6d9ca4e70..32b2f5f6c01442714f82b7ee25de6e968e13874f 100644 (file)
@@ -54,10 +54,10 @@ C: <ansi> ansi
 M:: ansi stream-format ( str style stream -- )
     stream stream>> :> out
     style foreground of [ color>foreground out stream-write t ] [ f ] if*
-    style background of [ color>background out stream-write t ] [ f ] if*
-    style font-style of [ font-styles out stream-write t ] [ f ] if*
+    style background of [ color>background out stream-write drop t ] when*
+    style font-style of [ font-styles out stream-write drop t ] when*
     str out stream-write
-    or or [ "\e[0m" out stream-write ] when ;
+    [ "\e[0m" out stream-write ] when ;
 
 M: ansi make-span-stream
     swap <style-stream> <ignore-close-stream> ;