summaryrefslogtreecommitdiff
path: root/src/System/IO/Terminal/IO.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2023-07-09 16:22:47 +0200
committerTom Smeding <tom@tomsmeding.com>2023-07-09 16:22:47 +0200
commitb3da0f16b5e47732bc1b2d632088830dab87a77d (patch)
tree413dd2f53da910f72eb6fe1e3ea31ffbb2aa25c4 /src/System/IO/Terminal/IO.hs
parent8418014253e3f5507dccfd4b7ef61c4402d6e0a6 (diff)
Handling of SIGWINCH (and some maintenance)HEADmaster
Diffstat (limited to 'src/System/IO/Terminal/IO.hs')
-rw-r--r--src/System/IO/Terminal/IO.hs34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/System/IO/Terminal/IO.hs b/src/System/IO/Terminal/IO.hs
index fb0f1c2..6d57d11 100644
--- a/src/System/IO/Terminal/IO.hs
+++ b/src/System/IO/Terminal/IO.hs
@@ -9,22 +9,15 @@ Portability : POSIX, macOS, Windows
Extra terminal management utility functions. This module basically extends
the @ansi-terminal@ package.
-}
-module System.IO.Terminal.IO
- (queryTermSize
- -- ,withWinchHandler
- ,toAlternateScreen
- ,fromAlternateScreen)
- where
+module System.IO.Terminal.IO (
+ queryTermSize,
+ toAlternateScreen,
+ fromAlternateScreen,
+) where
--- import Foreign.C.Types
import qualified System.Console.Terminal.Size as TS
--- import System.Exit
+import System.Exit
import System.IO
--- import System.Posix.Signals
-
-
--- sigWINCH :: CInt
--- sigWINCH = 28
-- | Request the current terminal size from the terminal. Probably not very
@@ -32,20 +25,7 @@ import System.IO
queryTermSize :: IO (Int, Int)
queryTermSize = TS.size >>= \case
Just win -> return (TS.width win, TS.height win)
- Nothing -> error "Cannot get terminal size"
-
--- withWinchHandler :: IO () -> IO a -> IO a
--- withWinchHandler h act = do
--- prevh <- installHandler sigWINCH (Catch h) Nothing
--- case prevh of
--- Default -> return ()
--- Ignore -> return ()
--- _ -> die "ERROR: A signal handler was already installed for the WINCH signal!"
-
--- res <- act
-
--- _ <- installHandler sigWINCH prevh Nothing
--- return res
+ Nothing -> die "ERROR: Cannot get terminal size"
-- | Switch to the \"alternate screen\", if the terminal supports it.
toAlternateScreen :: IO ()