From 31111d15c839fcb93f105a3c06896dbcf5b87816 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Apr 2023 15:38:47 -0400 Subject: [PATCH] newline and tab are safe control characters Oops, let's let git-annex display those! Lol --- Utility/SafeOutput.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Utility/SafeOutput.hs b/Utility/SafeOutput.hs index fae36c274e..275797adda 100644 --- a/Utility/SafeOutput.hs +++ b/Utility/SafeOutput.hs @@ -30,10 +30,17 @@ class SafeOutputtable t where safeOutput :: t -> t instance SafeOutputtable String where - safeOutput = filter (not . isControl) + safeOutput = filter safeChar instance SafeOutputtable S.ByteString where - safeOutput = S.filter (not . isControl . chr . fromIntegral) + safeOutput = S.filter (safeChar . chr . fromIntegral) + +safeChar :: Char -> Bool +safeChar c + | not (isControl c) = True + | c == '\n' = True + | c == '\t' = True + | otherwise = False newtype IsTerminal = IsTerminal Bool