Portability | portable (FFI) |
---|---|
Stability | experimental |
Maintainer | judah.jacobson@gmail.com |
Safe Haskell | Safe |
This module provides capabilities for moving the cursor on the terminal.
- termLines :: Capability Int
- termColumns :: Capability Int
- autoRightMargin :: Capability Bool
- autoLeftMargin :: Capability Bool
- wraparoundGlitch :: Capability Bool
- carriageReturn :: TermStr s => Capability s
- newline :: TermStr s => Capability s
- scrollForward :: TermStr s => Capability s
- scrollReverse :: TermStr s => Capability s
- moveDown :: TermStr s => Capability (Int -> s)
- moveLeft :: TermStr s => Capability (Int -> s)
- moveRight :: TermStr s => Capability (Int -> s)
- moveUp :: TermStr s => Capability (Int -> s)
- cursorDown1 :: TermStr s => Capability s
- cursorLeft1 :: TermStr s => Capability s
- cursorRight1 :: TermStr s => Capability s
- cursorUp1 :: TermStr s => Capability s
- cursorDown :: TermStr s => Capability (Int -> s)
- cursorLeft :: TermStr s => Capability (Int -> s)
- cursorRight :: TermStr s => Capability (Int -> s)
- cursorUp :: TermStr s => Capability (Int -> s)
- cursorHome :: TermStr s => Capability s
- cursorToLL :: TermStr s => Capability s
- cursorAddress :: TermStr s => Capability (Point -> s)
- data Point = Point {}
- rowAddress :: TermStr s => Capability (Int -> s)
- columnAddress :: TermStr s => Capability (Int -> s)
Terminal dimensions
Get the default size of the terminal. For
resizeable terminals (e.g., xterm
), these may not
correspond to the actual dimensions.
Cursor flags
autoRightMargin :: Capability BoolSource
This flag specifies that the cursor wraps automatically from the last column of one line to the first column of the next.
autoLeftMargin :: Capability BoolSource
This flag specifies that a backspace at column 0 wraps the cursor to the last column of the previous line.
wraparoundGlitch :: Capability BoolSource
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 :: TermStr s => Capability sSource
The cr
capability, which moves the cursor to the first column of the
current line.
newline :: TermStr s => Capability sSource
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 :: TermStr s => Capability sSource
scrollReverse :: TermStr s => Capability sSource
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 :: TermStr s => Capability (Int -> s)Source
moveLeft :: TermStr s => Capability (Int -> s)Source
moveRight :: TermStr s => Capability (Int -> s)Source
moveUp :: TermStr s => Capability (Int -> s)Source
Primitive movement capabilities
These capabilities correspond directly to cub
, cud
,
cub1
, cud1
, etc.
cursorDown1 :: TermStr s => Capability sSource
cursorLeft1 :: TermStr s => Capability sSource
cursorRight1 :: TermStr s => Capability sSource
cursorUp1 :: TermStr s => Capability sSource
cursorDown :: TermStr s => Capability (Int -> s)Source
cursorLeft :: TermStr s => Capability (Int -> s)Source
cursorRight :: TermStr s => Capability (Int -> s)Source
cursorUp :: TermStr s => Capability (Int -> s)Source
cursorHome :: TermStr s => Capability sSource
cursorToLL :: TermStr s => Capability sSource
Absolute cursor movements
cursorAddress :: TermStr s => Capability (Point -> s)Source
rowAddress :: TermStr s => Capability (Int -> s)Source
columnAddress :: TermStr s => Capability (Int -> s)Source