newline and tab are safe control characters
Oops, let's let git-annex display those! Lol
This commit is contained in:
parent
4a5f18a8ec
commit
31111d15c8
1 changed files with 9 additions and 2 deletions
|
@ -30,10 +30,17 @@ class SafeOutputtable t where
|
||||||
safeOutput :: t -> t
|
safeOutput :: t -> t
|
||||||
|
|
||||||
instance SafeOutputtable String where
|
instance SafeOutputtable String where
|
||||||
safeOutput = filter (not . isControl)
|
safeOutput = filter safeChar
|
||||||
|
|
||||||
instance SafeOutputtable S.ByteString where
|
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
|
newtype IsTerminal = IsTerminal Bool
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue