| terminfo-0.3.1: Haskell bindings to the terminfo library. | Source code | Contents | Index

System.Console.Terminfo.Cursor

Portability | portable (FFI)
Stability | experimental
Maintainer | judah.jacobson@gmail.com

Contents

Terminal dimensions
Cursor flags
Scrolling
Relative cursor movements
  Primitive movement capabilities
Absolute cursor movements

Description
This module provides capabilities for moving the cursor on the terminal.
Synopsis

termLines :: Capability Int
termColumns :: Capability Int
autoRightMargin :: Capability Bool
autoLeftMargin :: Capability Bool
wraparoundGlitch :: Capability Bool
carriageReturn :: Capability TermOutput
newline :: Capability TermOutput
scrollForward :: Capability TermOutput
scrollReverse :: Capability TermOutput
moveDown :: Capability (Int -> TermOutput)
moveLeft :: Capability (Int -> TermOutput)
moveRight :: Capability (Int -> TermOutput)
moveUp :: Capability (Int -> TermOutput)
cursorDown1 :: Capability TermOutput
cursorLeft1 :: Capability TermOutput
cursorRight1 :: Capability TermOutput
cursorUp1 :: Capability TermOutput
cursorDown :: Capability (Int -> TermOutput)
cursorLeft :: Capability (Int -> TermOutput)
cursorRight :: Capability (Int -> TermOutput)
cursorUp :: Capability (Int -> TermOutput)
cursorHome :: Capability TermOutput
cursorToLL :: Capability TermOutput
cursorAddress :: Capability (Point -> TermOutput)

data Point = Point {

row :: Int
col :: Int

}

rowAddress :: Capability (Int -> TermOutput)
columnAddress :: Capability (Int -> TermOutput)

Terminal dimensions
Get the default size of the terminal. For resizeable terminals (e.g., `xterm`), these may not correspond to the actual dimensions.

termLines :: Capability Int | Source

termColumns :: Capability Int | Source

Cursor flags

autoRightMargin :: Capability Bool | Source

This flag specifies that the cursor wraps automatically from the last column of one line to the first column of the next.

autoLeftMargin :: Capability Bool | Source

This flag specifies that a backspace at column 0 wraps the cursor to the last column of the previous line.

wraparoundGlitch :: Capability Bool | Source

This flag specifies that the terminal does not perform `autoRightMargin`-style wrapping when the character which would cause the wraparound is a control character. This is also known as the "newline glitch" or "magic wrap".

For example, in an 80-column terminal with this behavior, the following will print single-spaced instead of double-spaced:

     replicateM_ 5 $ putStr $ replicate 80 'x' ++ "\n"

Scrolling

carriageReturn :: Capability TermOutput | Source

The `cr` capability, which moves the cursor to the first column of the current line.

newline :: Capability TermOutput | Source

The `nel` capability, which moves the cursor to the first column of the next line. It behaves like a carriage return followed by a line feed. If `nel` is not defined, this may be built out of other capabilities.

scrollForward :: Capability TermOutput | Source

scrollReverse :: Capability TermOutput | Source

Relative cursor movements
The following functions for cursor movement will combine the more primitive capabilities. For example, `moveDown` may use either `cursorDown` or `cursorDown1` depending on the parameter and which of `cud` and `cud1` are defined.

moveDown :: Capability (Int -> TermOutput) | Source

moveLeft :: Capability (Int -> TermOutput) | Source

moveRight :: Capability (Int -> TermOutput) | Source

moveUp :: Capability (Int -> TermOutput) | Source

Primitive movement capabilities
These capabilities correspond directly to `cub`, `cud`, `cub1`, `cud1`, etc.

cursorDown1 :: Capability TermOutput | Source

cursorLeft1 :: Capability TermOutput | Source

cursorRight1 :: Capability TermOutput | Source

cursorUp1 :: Capability TermOutput | Source

cursorDown :: Capability (Int -> TermOutput) | Source

cursorLeft :: Capability (Int -> TermOutput) | Source

cursorRight :: Capability (Int -> TermOutput) | Source

cursorUp :: Capability (Int -> TermOutput) | Source

cursorHome :: Capability TermOutput | Source

cursorToLL :: Capability TermOutput | Source

Absolute cursor movements

cursorAddress :: Capability (Point -> TermOutput) | Source

data Point | Source

Constructors

Point |

row :: Int |
col :: Int |

rowAddress :: Capability (Int -> TermOutput) | Source

columnAddress :: Capability (Int -> TermOutput) | Source

Produced by Haddock version 2.4.2