on master help sign in
Fold isMinTTY into isATTY
commit29ec929e06de070adb364dfb08acdc833a1de9dc authorRyan Scott <ryan.gl.scott@gmail.com> dateTue 31 Jan 2017, 09:23 (10 years ago) parentfb221e8
3 files changed+8−11
src/Idris/Main.hs+2−3 src/Idris/Output.hs+3−5 src/Util/System.hs+3−3
src/Idris/Main.hs+2−3
@@ -105,9 +105,8 @@ idrisMain opts =
105105
106106 when (DefaultTotal `elem` opts) $ do i <- getIState
107107 putIState (i { default_total = DefaultCheckingTotal })
108− tty <- runIO isATTY
109− mintty <- runIO isMinTTY
110− setColourise $ not quiet && last ((tty || mintty) : opt getColour opts)
108+ tty <- runIO isATTY
109+ setColourise $ not quiet && last (tty : opt getColour opts)
111110
112111
113112
src/Idris/Output.hs+3−5
@@ -20,7 +20,7 @@ import Idris.IdeMode
2020
2121import Util.Pretty
2222import Util.ScreenSize (getScreenWidth)
23−import Util.System (isATTY, isMinTTY)
23+import Util.System (isATTY)
2424
2525import Prelude hiding ((<$>))
2626
@@ -65,16 +65,14 @@ iRender d = do w <- getWidth
6565 let ideMode = case idris_outputmode ist of
6666 IdeMode _ _ -> True
6767 _ -> False
68− tty <- runIO isATTY
69− mintty <- runIO isMinTTY
68+ tty <- runIO isATTY
7069 case w of
7170 InfinitelyWide -> return $ renderPretty 1.0 1000000000 d
7271 ColsWide n -> return $
7372 if n < 1
7473 then renderPretty 1.0 1000000000 d
7574 else renderPretty 0.8 n d
76− AutomaticWidth | ideMode || not (tty || mintty) ->
77− return $ renderPretty 1.0 80 d
75+ AutomaticWidth | ideMode || not tty -> return $ renderPretty 1.0 80 d
7876 | otherwise -> do width <- runIO getScreenWidth
7977 return $ renderPretty 0.8 width d
8078
src/Util/System.hs+3−3
@@ -16,7 +16,6 @@ module Util.System( tempfile
1616 , readSource
1717 , setupBundledCC
1818 , isATTY
19− , isMinTTY
2019 ) where
2120
2221import Control.Exception as CE
@@ -73,8 +72,9 @@ foreign import ccall "isatty" isATTYRaw :: CInt -> IO CInt
7372
7473isATTY :: IO Bool
7574isATTY = do
76− tty <- isATTYRaw 1 -- fd stdout
77− return $ tty /= 0
75+ tty <- isATTYRaw 1 -- fd stdout
76+ mintty <- isMinTTY
77+ return $ (tty /= 0) || mintty
7878
7979-- | Return 'True' if the process's standard output is attached to a MinTTY
8080-- console (e.g., Cygwin or MSYS) on Windows. Return 'False' otherwise.