newline and tab are safe control characters

Oops, let's let git-annex display those! Lol
This commit is contained in:
Joey Hess 2023-04-11 15:38:47 -04:00
parent 4a5f18a8ec
commit 31111d15c8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -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