Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTermNotFound indicates that a suitable terminal entry could // not be found. This can result from either not having TERM set, // or from the TERM failing to support certain minimal functionality, // in particular absolute cursor addressability (the cup capability) // is required. For example, legacy "adm3" lacks this capability, // whereas the slightly newer "adm3a" supports it. This failure // occurs most often with "dumb". ErrTermNotFound = errors.New("terminal entry not found") )
Functions ¶
func AddTerminfo ¶
func AddTerminfo(t *Terminfo)
AddTerminfo can be called to register a new Terminfo entry.
Types ¶
type Terminfo ¶
type Terminfo struct { Name string `json:"name"` Aliases []string `json:"aliases,omitempty"` Columns int `json:"cols,omitempty"` // cols Lines int `json:"lines,omitempty"` // lines Colors int `json:"colors,omitempty"` // colors Bell string `json:"bell,omitempty"` // bell Clear string `json:"clear,omitempty"` // clear EnterCA string `json:"smcup,omitempty"` // smcup ExitCA string `json:"rmcup,omitempty"` // rmcup ShowCursor string `json:"cnorm,omitempty"` // cnorm HideCursor string `json:"civis,omitempty"` // civis AttrOff string `json:"sgr0,omitempty"` // sgr0 Underline string `json:"smul,omitempty"` // smul Bold string `json:"bold,omitempty"` // bold Blink string `json:"blink,omitempty"` // blink Reverse string `json:"rev,omitempty"` // rev Dim string `json:"dim,omitempty"` // dim EnterKeypad string `json:"smkx,omitempty"` // smkx ExitKeypad string `json:"rmkx,omitempty"` // rmkx SetFg string `json:"setaf,omitempty"` // setaf SetBg string `json:"setbg,omitempty"` // setab SetCursor string `json:"cup,omitempty"` // cup CursorBack1 string `json:"cub1,omitempty"` // cub1 CursorUp1 string `json:"cuu1,omitempty"` // cuu1 PadChar string `json:"pad,omitempty"` // pad KeyBackspace string `json:"kbs,omitempty"` // kbs KeyF1 string `json:"kf1,omitempty"` // kf1 KeyF2 string `json:"kf2,omitempty"` // kf2 KeyF3 string `json:"kf3,omitempty"` // kf3 KeyF4 string `json:"kf4,omitempty"` // kf4 KeyF5 string `json:"kf5,omitempty"` // kf5 KeyF6 string `json:"kf6,omitempty"` // kf6 KeyF7 string `json:"kf7,omitempty"` // kf7 KeyF8 string `json:"kf8,omitempty"` // kf8 KeyF9 string `json:"kf9,omitempty"` // kf9 KeyF10 string `json:"kf10,omitempty"` // kf10 KeyF11 string `json:"kf11,omitempty"` // kf11 KeyF12 string `json:"kf12,omitempty"` // kf12 KeyF13 string `json:"kf13,omitempty"` // kf13 KeyF14 string `json:"kf14,omitempty"` // kf14 KeyF15 string `json:"kf15,omitempty"` // kf15 KeyF16 string `json:"kf16,omitempty"` // kf16 KeyF17 string `json:"kf17,omitempty"` // kf17 KeyF18 string `json:"kf18,omitempty"` // kf18 KeyF19 string `json:"kf19,omitempty"` // kf19 KeyF20 string `json:"kf20,omitempty"` // kf20 KeyF21 string `json:"kf21,omitempty"` // kf21 KeyF22 string `json:"kf22,omitempty"` // kf22 KeyF23 string `json:"kf23,omitempty"` // kf23 KeyF24 string `json:"kf24,omitempty"` // kf24 KeyF25 string `json:"kf25,omitempty"` // kf25 KeyF26 string `json:"kf26,omitempty"` // kf26 KeyF27 string `json:"kf27,omitempty"` // kf27 KeyF28 string `json:"kf28,omitempty"` // kf28 KeyF29 string `json:"kf29,omitempty"` // kf29 KeyF30 string `json:"kf30,omitempty"` // kf30 KeyF31 string `json:"kf31,omitempty"` // kf31 KeyF32 string `json:"kf32,omitempty"` // kf32 KeyF33 string `json:"kf33,omitempty"` // kf33 KeyF34 string `json:"kf34,omitempty"` // kf34 KeyF35 string `json:"kf35,omitempty"` // kf35 KeyF36 string `json:"kf36,omitempty"` // kf36 KeyF37 string `json:"kf37,omitempty"` // kf37 KeyF38 string `json:"kf38,omitempty"` // kf38 KeyF39 string `json:"kf39,omitempty"` // kf39 KeyF40 string `json:"kf40,omitempty"` // kf40 KeyF41 string `json:"kf41,omitempty"` // kf41 KeyF42 string `json:"kf42,omitempty"` // kf42 KeyF43 string `json:"kf43,omitempty"` // kf43 KeyF44 string `json:"kf44,omitempty"` // kf44 KeyF45 string `json:"kf45,omitempty"` // kf45 KeyF46 string `json:"kf46,omitempty"` // kf46 KeyF47 string `json:"kf47,omitempty"` // kf47 KeyF48 string `json:"kf48,omitempty"` // kf48 KeyF49 string `json:"kf49,omitempty"` // kf49 KeyF50 string `json:"kf50,omitempty"` // kf50 KeyF51 string `json:"kf51,omitempty"` // kf51 KeyF52 string `json:"kf52,omitempty"` // kf52 KeyF53 string `json:"kf53,omitempty"` // kf53 KeyF54 string `json:"kf54,omitempty"` // kf54 KeyF55 string `json:"kf55,omitempty"` // kf55 KeyF56 string `json:"kf56,omitempty"` // kf56 KeyF57 string `json:"kf57,omitempty"` // kf57 KeyF58 string `json:"kf58,omitempty"` // kf58 KeyF59 string `json:"kf59,omitempty"` // kf59 KeyF60 string `json:"kf60,omitempty"` // kf60 KeyF61 string `json:"kf61,omitempty"` // kf61 KeyF62 string `json:"kf62,omitempty"` // kf62 KeyF63 string `json:"kf63,omitempty"` // kf63 KeyF64 string `json:"kf64,omitempty"` // kf64 KeyInsert string `json:"kich,omitempty"` // kich1 KeyDelete string `json:"kdch,omitempty"` // kdch1 KeyHome string `json:"khome,omitempty"` // khome KeyEnd string `json:"kend,omitempty"` // kend KeyHelp string `json:"khlp,omitempty"` // khlp KeyPgUp string `json:"kpp,omitempty"` // kpp KeyPgDn string `json:"knp,omitempty"` // knp KeyUp string `json:"kcuu1,omitempty"` // kcuu1 KeyDown string `json:"kcud1,omitempty"` // kcud1 KeyLeft string `json:"kcub1,omitempty"` // kcub1 KeyRight string `json:"kcuf1,omitempty"` // kcuf1 KeyBacktab string `json:"kcbt,omitempty"` // kcbt KeyExit string `json:"kext,omitempty"` // kext KeyClear string `json:"kclr,omitempty"` // kclr KeyPrint string `json:"kprt,omitempty"` // kprt KeyCancel string `json:"kcan,omitempty"` // kcan Mouse string `json:"kmous,omitempty"` // kmous MouseMode string `json:"XM,omitempty"` // XM AltChars string `json:"acsc,omitempty"` // acsc EnterAcs string `json:"smacs,omitempty"` // smacs ExitAcs string `json:"rmacs,omitempty"` // rmacs EnableAcs string `json:"enacs,omitempty"` // enacs KeyShfRight string `json:"kRIT,omitempty"` // kRIT KeyShfLeft string `json:"kLFT,omitempty"` // kLFT KeyShfHome string `json:"kHOM,omitempty"` // kHOM KeyShfEnd string `json:"kEND,omitempty"` // kEND SetFgBg string `json:"_setfgbg,omitempty"` // setfgbg SetFgBgRGB string `json:"_setfgbgrgb,omitempty"` // setfgbgrgb SetFgRGB string `json:"_setfrgb,omitempty"` // setfrgb SetBgRGB string `json:"_setbrgb,omitempty"` // setbrgb KeyShfUp string `json:"_kscu1,omitempty"` // shift-up KeyShfDown string `json:"_kscud1,omitempty"` // shift-down KeyCtrlUp string `json:"_kccu1,omitempty"` // ctrl-up KeyCtrlDown string `json:"_kccud1,omitempty"` // ctrl-left KeyCtrlRight string `json:"_kccuf1,omitempty"` // ctrl-right KeyCtrlLeft string `json:"_kccub1,omitempty"` // ctrl-left KeyMetaUp string `json:"_kmcu1,omitempty"` // meta-up KeyMetaDown string `json:"_kmcud1,omitempty"` // meta-left KeyMetaRight string `json:"_kmcuf1,omitempty"` // meta-right KeyMetaLeft string `json:"_kmcub1,omitempty"` // meta-left KeyAltUp string `json:"_kacu1,omitempty"` // alt-up KeyAltDown string `json:"_kacud1,omitempty"` // alt-left KeyAltRight string `json:"_kacuf1,omitempty"` // alt-right KeyAltLeft string `json:"_kacub1,omitempty"` // alt-left KeyCtrlHome string `json:"_kchome,omitempty"` KeyCtrlEnd string `json:"_kcend,omitempty"` KeyMetaHome string `json:"_kmhome,omitempty"` KeyMetaEnd string `json:"_kmend,omitempty"` KeyAltHome string `json:"_kahome,omitempty"` KeyAltEnd string `json:"_kaend,omitempty"` KeyAltShfUp string `json:"_kascu1,omitempty"` KeyAltShfDown string `json:"_kascud1,omitempty"` KeyAltShfLeft string `json:"_kascub1,omitempty"` KeyAltShfRight string `json:"_kascuf1,omitempty"` KeyMetaShfUp string `json:"_kmscu1,omitempty"` KeyMetaShfDown string `json:"_kmscud1,omitempty"` KeyMetaShfLeft string `json:"_kmscub1,omitempty"` KeyMetaShfRight string `json:"_kmscuf1,omitempty"` KeyCtrlShfUp string `json:"_kcscu1,omitempty"` KeyCtrlShfDown string `json:"_kcscud1,omitempty"` KeyCtrlShfLeft string `json:"_kcscub1,omitempty"` KeyCtrlShfRight string `json:"_kcscuf1,omitempty"` KeyCtrlShfHome string `json:"_kcHOME,omitempty"` KeyCtrlShfEnd string `json:"_kcEND,omitempty"` KeyAltShfHome string `json:"_kaHOME,omitempty"` KeyAltShfEnd string `json:"_kaEND,omitempty"` KeyMetaShfHome string `json:"_kmHOME,omitempty"` KeyMetaShfEnd string `json:"_kmEND,omitempty"` }
Terminfo represents a terminfo entry. Note that we use friendly names in Go, but when we write out JSON, we use the same names as terminfo. The name, aliases and smous, rmous fields do not come from terminfo directly.
func LookupTerminfo ¶
LookupTerminfo attempts to find a definition for the named $TERM. It first looks in the builtin database, which should cover just about everyone. If it can't find one there, then it will attempt to read one from the JSON file located in either $TCELLDB, $HOME/.tcelldb, or as a database file.
The database files are named by taking terminal name, hashing it through sha1, and then a subdirectory of the form database/hash[0:2]/hash[0:8] (with an optional .gz extension).
For other local database files, we will look for the database file using the terminal name, so database/term[0:2]/term[0:8], again with optional .gz extension.
func (*Terminfo) TColor ¶
TColor returns a string corresponding to the given foreground and background colors. Either fg or bg can be set to -1 to elide.
func (*Terminfo) TGoto ¶
TGoto returns a string suitable for addressing the cursor at the given row and column. The origin 0, 0 is in the upper left corner of the screen.
func (*Terminfo) TParm ¶
TParm takes a terminfo parameterized string, such as setaf or cup, and evaluates the string, and returns the result with the parameter applied.
func (*Terminfo) TPuts ¶
TPuts emits the string to the writer, but expands inline padding indications (of the form $<[delay]> where [delay] is msec) to a suitable number of padding characters (usually null bytes) based upon the supplied baud. At high baud rates, more padding characters will be inserted. All Terminfo based strings should be emitted using this function.
Source Files ¶
- term_adm3a.go
- term_aixterm.go
- term_ansi.go
- term_aterm.go
- term_beterm.go
- term_bsdos_pc.go
- term_cygwin.go
- term_d200.go
- term_d210.go
- term_dtterm.go
- term_gnome.go
- term_gnome_256color.go
- term_hpterm.go
- term_hz1500.go
- term_konsole.go
- term_konsole_256color.go
- term_kterm.go
- term_linux.go
- term_pcansi.go
- term_rxvt.go
- term_rxvt_256color.go
- term_rxvt_unicode.go
- term_rxvt_unicode_256color.go
- term_screen.go
- term_screen_256color.go
- term_st.go
- term_st_256color.go
- term_st_meta.go
- term_st_meta_256color.go
- term_st_meta_truecolor.go
- term_st_truecolor.go
- term_sun.go
- term_sun_color.go
- term_termite.go
- term_tvi910.go
- term_tvi912.go
- term_tvi921.go
- term_tvi925.go
- term_tvi950.go
- term_tvi970.go
- term_vt100.go
- term_vt102.go
- term_vt220.go
- term_vt320.go
- term_vt400.go
- term_vt420.go
- term_vt52.go
- term_wy50.go
- term_wy60.go
- term_wy99_ansi.go
- term_wy99a_ansi.go
- term_xfce.go
- term_xnuppc.go
- term_xterm.go
- term_xterm_256color.go
- term_xterm_truecolor.go
- terminfo.go