BSD-3-Clause licensed by Andreas Hammar, Matvey Aksenov
Maintained by [email protected]
This version can be pinned in stack with:terminal-size-0.3.4@sha256:21d7f1320eeb86177e860ec07a3d8e7510977b1b415a96ebb62ee4ad72955770,1364

Module documentation for 0.3.4

terminal-size

Hackage Build Status

Get terminal window width and height

Usage

>>> import System.Console.Terminal.Size
>>> size
Just (Window {height = 60, width = 112})

Test

Compile test.hs and run it in a terminal. Here is what I get on Linux:

> ghc test.hs
> ./test
With redirected stdin
  hSize stdin = Nothing
  hSize stdout = Just (Window {height = 19, width = 87})
  hSize stderr = Just (Window {height = 19, width = 87})
With redirected stdout
  hSize stdin = Just (Window {height = 19, width = 87})
  hSize stdout = Nothing
  hSize stderr = Just (Window {height = 19, width = 87})
With redirected stderr
  hSize stdin = Just (Window {height = 19, width = 87})
  hSize stdout = Just (Window {height = 19, width = 87})
  hSize stderr = Nothing

On MINGW/MSYS the output is the same.

On Windows with cmd.exe I get

With redirected stdin
  hSize stdin = Nothing
  hSize stdout = Just (Window {height = 40, width = 164})
  hSize stderr = Just (Window {height = 40, width = 164})
With redirected stdout
  hSize stdin = Nothing
  hSize stdout = Nothing
  hSize stderr = Just (Window {height = 40, width = 164})
With redirected stderr
  hSize stdin = Nothing
  hSize stdout = Just (Window {height = 40, width = 164})
  hSize stderr = Nothing

Changes

0.3.4

0.3.3

0.3.2.1

0.3.2

0.3.1

  • Typeable, Data, Generic, and Generic1 instances for Window.

0.3.0