Copyright | (c) 2022 Dmitrii Kovanikov |
---|---|
License | MPL-2.0 |
Maintainer | Dmitrii Kovanikov <kovanikov@gmail.com> |
Stability | Experimental |
Portability | Portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Utility functions to work with the terminal output.
Synopsis
- getTerminalWidth :: IO Int
- clearScreen :: Int -> IO ()
- withAlternateBuffer :: IO a -> IO a
Documentation
getTerminalWidth :: IO Int Source #
Get the width of the current terminal.
This function exits the process with the message if it can't get the width of the current terminal.
clearScreen :: Int -> IO () Source #
Clears the the screenHeight
number of lines in the screen. Pass
the number of lines in the output to clear the entire screen.
withAlternateBuffer :: IO a -> IO a Source #
Run action in the alternate buffer and return to the normal screen after exception or SIGINT.
NOTE: This function always returns to the normal screen after the action. If you want to print something to the normal screen use the result of the given action afterwards.