vty-5.2.1: A simple terminal UI library

Safe HaskellSafe-Inferred




classifyMapForTerm :: String -> Terminal -> ClassifyMapSource

queries the terminal for all capability based input sequences then adds on a terminal dependent input sequence mapping.

For reference see:

  • http:vimdoc.sourceforge.nethtmldocterm.html
  • vim74srcterm.c
  • http:invisible-island.netvttest
  • http:aperiodic.netphilarchivesGeekeryterm-function-keys.html

This is painful. Terminfo is incomplete. The vim source implies that terminfo is also incorrect. Vty assumes that the an internal terminfo table added to the system provided terminfo table is correct.

  1. build terminfo table for all caps. Missing caps are not added.
  2. add tables for visible chars, esc, del plus ctrl and meta
  3. add internally defined table for given terminal type.

Precedence is currently implicit in the compile algorithm. Which is a bit odd.

todo terminfo meta is not supported. todo no 8bit

universalTable :: ClassifyMapSource

key table applicable to all terminals.

TODO: some probably only applicable to ANSI/VT100 terminals.

termSpecificTables :: String -> [ClassifyMap]Source

tables specific to a given terminal that are not derivable from terminfo.

TODO: Adds the ANSIVT100VT50 tables regardless of term identifier.

visibleChars :: ClassifyMapSource

Visible characters in the ISO-8859-1 and UTF-8 common set.

we limit to < 0xC1. The UTF8 sequence detector will catch all values 0xC2 and above before this classify table is reached.

TODO: resolve 1. start at ' '. The earlier characters are all ctrlChar

ctrlChars :: ClassifyMapSource

Non visible characters in the ISO-8859-1 and UTF-8 common set translated to ctrl + char.

todo resolve CTRL-i is the same as tab

specialSupportKeys :: ClassifyMapSource

esc, meta esc, delete, meta delete, enter, meta enter

keysFromCapsTable :: ClassifyMapSource

classify table directly generated from terminfo cap strings

these are:

  • ka1 - keypad up-left
  • ka3 - keypad up-right
  • kb2 - keypad center
  • kbs - keypad backspace
  • kbeg - begin
  • kcbt - back tab
  • kc1 - keypad left-down
  • kc3 - keypad right-down
  • kdch1 - delete
  • kcud1 - down
  • kend - end
  • kent - enter
  • kf0 - kf63 - function keys
  • khome - KHome
  • kich1 - insert
  • kcub1 - left
  • knp - next page (page down)
  • kpp - previous page (page up)
  • kcuf1 - right
  • kDC - shift delete
  • kEND - shift end
  • kHOM - shift home
  • kIC - shift insert
  • kLFT - shift left
  • kRIT - shift right
  • kcuu1 - up

functionKeyCapsTable :: ClassifyMapSource

cap names for function keys