on master help sign in
Fold isMinTTY into isATTY
29ec929Ryan Scott
src/Idris/Main.hs+2−3
@@ -105,9 +105,8 @@ idrisMain opts =
105
105
106 when (DefaultTotal `elem` opts) $ do i <- getIState
106 when (DefaultTotal `elem` opts) $ do i <- getIState
107 putIState (i { default_total = DefaultCheckingTotal })
107 putIState (i { default_total = DefaultCheckingTotal })
108− tty <- runIO isATTY
108+ tty <- runIO isATTY
109− mintty <- runIO isMinTTY
110− setColourise $ not quiet && last ((tty || mintty) : opt getColour opts)
109+ setColourise $ not quiet && last (tty : opt getColour opts)
111
110
112
111
113
112
src/Idris/Output.hs+3−5
@@ -20,7 +20,7 @@ import Idris.IdeMode
20
20
21import Util.Pretty
21import Util.Pretty
22import Util.ScreenSize (getScreenWidth)
22import Util.ScreenSize (getScreenWidth)
23−import Util.System (isATTY, isMinTTY)
23+import Util.System (isATTY)
24
24
25import Prelude hiding ((<$>))
25import Prelude hiding ((<$>))
26
26
@@ -65,16 +65,14 @@ iRender d = do w <- getWidth
65 let ideMode = case idris_outputmode ist of
65 let ideMode = case idris_outputmode ist of
66 IdeMode _ _ -> True
66 IdeMode _ _ -> True
67 _ -> False
67 _ -> False
68− tty <- runIO isATTY
68+ tty <- runIO isATTY
69− mintty <- runIO isMinTTY
70 case w of
69 case w of
71 InfinitelyWide -> return $ renderPretty 1.0 1000000000 d
70 InfinitelyWide -> return $ renderPretty 1.0 1000000000 d
72 ColsWide n -> return $
71 ColsWide n -> return $
73 if n < 1
72 if n < 1
74 then renderPretty 1.0 1000000000 d
73 then renderPretty 1.0 1000000000 d
75 else renderPretty 0.8 n d
74 else renderPretty 0.8 n d
76− AutomaticWidth | ideMode || not (tty || mintty) ->
75+ AutomaticWidth | ideMode || not tty -> return $ renderPretty 1.0 80 d
77− return $ renderPretty 1.0 80 d
78 | otherwise -> do width <- runIO getScreenWidth
76 | otherwise -> do width <- runIO getScreenWidth
79 return $ renderPretty 0.8 width d
77 return $ renderPretty 0.8 width d
80
78
src/Util/System.hs+3−3
@@ -16,7 +16,6 @@ module Util.System( tempfile
16 , readSource
16 , readSource
17 , setupBundledCC
17 , setupBundledCC
18 , isATTY
18 , isATTY
19− , isMinTTY
20 ) where
19 ) where
21
20
22import Control.Exception as CE
21import Control.Exception as CE
@@ -73,8 +72,9 @@ foreign import ccall "isatty" isATTYRaw :: CInt -> IO CInt
73
72
74isATTY :: IO Bool
73isATTY :: IO Bool
75isATTY = do
74isATTY = do
76− tty <- isATTYRaw 1 -- fd stdout
75+ tty <- isATTYRaw 1 -- fd stdout
76+ mintty <- isMinTTY
77− return $ tty /= 0
77+ return $ (tty /= 0) || mintty
78
78
79-- | Return 'True' if the process's standard output is attached to a MinTTY
79-- | Return 'True' if the process's standard output is attached to a MinTTY
80-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.
80-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.