ansi-terminal-0.6.3: Simple ANSI terminal support, with Windows compatibility

Safe HaskellSafe
LanguageHaskell98

System.Console.ANSI.Codes

Contents

Description

Functions that return String values containing codes in accordance with: (1) standard ECMA-48 Control Functions for Coded Character Sets (5th edition, 1991); or (2) in the case of setTitleCode, the XTerm control sequence.

The reference used for the codes in this module was http://en.wikipedia.org/wiki/ANSI_escape_sequences.

If module System.Console.ANSI is also imported, this module is intended to be imported qualified, to avoid name clashes with functions which return "" when Windows ANSI terminal support is emulated. e.g.

import qualified System.Console.ANSI.Codes as ANSI

Synopsis

Basic data types

Cursor movement by character

cursorUpCode Source #

Arguments

:: Int

Number of lines or characters to move

-> String 

cursorDownCode Source #

Arguments

:: Int

Number of lines or characters to move

-> String 

cursorForwardCode Source #

Arguments

:: Int

Number of lines or characters to move

-> String 

cursorBackwardCode Source #

Arguments

:: Int

Number of lines or characters to move

-> String 

Cursor movement by line

cursorUpLineCode Source #

Arguments

:: Int

Number of lines to move

-> String 

cursorDownLineCode Source #

Arguments

:: Int

Number of lines to move

-> String 

Directly changing cursor position

setCursorColumnCode Source #

Arguments

:: Int

0-based column to move to

-> String 

setCursorPositionCode Source #

Arguments

:: Int

0-based row to move to

-> Int

0-based column to move to

-> String 

Clearing parts of the screen

Scrolling the screen

scrollPageUpCode Source #

Arguments

:: Int

Number of lines to scroll by

-> String 

scrollPageDownCode Source #

Arguments

:: Int

Number of lines to scroll by

-> String 

Select Graphic Rendition mode: colors and other whizzy stuff

setSGRCode Source #

Arguments

:: [SGR]

Commands: these will typically be applied on top of the current console SGR mode. An empty list of commands is equivalent to the list [Reset]. Commands are applied left to right.

-> String 

Cursor visibilty changes

Changing the title

Thanks to Brandon S. Allbery and Curt Sampson for pointing me in the right direction on xterm title setting on haskell-cafe. The "0" signifies that both the title and "icon" text should be set: i.e. the text for the window in the Start bar (or similar) as well as that in the actual window title. This is chosen for consistent behaviour between Unixes and Windows.

setTitleCode Source #

Arguments

:: String

New Icon Name and Window Title

-> String 

XTerm control sequence to set the Icon Name and Window Title.

Utilities

colorToCode :: Color -> Int Source #

colorToCode color returns the 0-based index of the color (one of the eight colors in the standard).

csi Source #

Arguments

:: [Int]

List of parameters for the control sequence

-> String

Character(s) that identify the control function

-> String 

csi parameters controlFunction, where parameters is a list of Int, returns the control sequence comprising the control function CONTROL SEQUENCE INTRODUCER (CSI) followed by the parameter(s) (separated by ';') and ending with the controlFunction character(s) that identifies the control function.

sgrToCode Source #

Arguments

:: SGR

The SGR aspect

-> Int 

sgrToCode sgr returns the parameter of the SELECT GRAPHIC RENDITION (SGR) aspect identified by sgr.