Debian Codegraph @

README.markdown

raw
1 terminal-size
2 =============
3
4 [![Hackage](https://img.shields.io/hackage/v/terminal-size.svg?style=flat)](https://hackage.haskell.org/package/terminal-size)
5 [![Build Status](https://travis-ci.org/biegunka/terminal-size.png)](https://travis-ci.org/biegunka/terminal-size)
6
7 Get terminal window width and height
8
9 Usage
10 -----
11
12 ```
13 >>> import System.Console.Terminal.Size
14 >>> size
15 Just (Window {height = 60, width = 112})
16 ```
17
18 Test
19 ----
20
21 Compile test.hs and run it in a terminal. Here is what I get on Linux:
22
23 ```
24 > ghc test.hs
25 > ./test
26 With redirected stdin
27 hSize stdin = Nothing
28 hSize stdout = Just (Window {height = 19, width = 87})
29 hSize stderr = Just (Window {height = 19, width = 87})
30 With redirected stdout
31 hSize stdin = Just (Window {height = 19, width = 87})
32 hSize stdout = Nothing
33 hSize stderr = Just (Window {height = 19, width = 87})
34 With redirected stderr
35 hSize stdin = Just (Window {height = 19, width = 87})
36 hSize stdout = Just (Window {height = 19, width = 87})
37 hSize stderr = Nothing
38 ```
39
40 On MINGW/MSYS the output is the same.
41
42 On Windows with cmd.exe I get
43
44 ```
45 With redirected stdin
46 hSize stdin = Nothing
47 hSize stdout = Just (Window {height = 40, width = 164})
48 hSize stderr = Just (Window {height = 40, width = 164})
49 With redirected stdout
50 hSize stdin = Nothing
51 hSize stdout = Nothing
52 hSize stderr = Just (Window {height = 40, width = 164})
53 With redirected stderr
54 hSize stdin = Nothing
55 hSize stdout = Just (Window {height = 40, width = 164})
56 hSize stderr = Nothing
57 ```