File: README.markdown

package info (click to toggle)
haskell-terminal-size 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80 kB
  • sloc: haskell: 107; makefile: 4
file content (57 lines) | stat: -rw-r--r-- 1,518 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
terminal-size
=============

[![Hackage](https://img.shields.io/hackage/v/terminal-size.svg?style=flat)](https://hackage.haskell.org/package/terminal-size)
[![Build Status](https://travis-ci.org/biegunka/terminal-size.png)](https://travis-ci.org/biegunka/terminal-size)

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
```