diff --git a/attr.go b/attr.go index 34671a8..585502e 100644 --- a/attr.go +++ b/attr.go @@ -18,17 +18,15 @@ package tcell // Note that support for attributes may vary widely across terminals. type AttrMask int -// NB: the colors listed here are in the order that ANSI terminals expect. - +// Attributes are not colors, but affect the display of text. They can +// be combined. const ( AttrBold AttrMask = 1 << (25 + iota) AttrBlink AttrReverse AttrUnderline AttrDim - - // AttrNone is just normal text. - AttrNone AttrMask = 0 + AttrNone AttrMask = 0 // Just normal text. ) const attrAll = AttrBold | AttrBlink | AttrReverse | AttrUnderline | AttrDim diff --git a/color.go b/color.go index 53413c6..e2de32a 100644 --- a/color.go +++ b/color.go @@ -423,6 +423,8 @@ const ( ColorYellowGreen ) +// These are aliases for the color gray, because some of us spell +// it as grey. const ( ColorGrey = ColorGray ColorDimGrey = ColorDimGray diff --git a/key.go b/key.go index 52141fb..0d882bf 100644 --- a/key.go +++ b/key.go @@ -261,13 +261,15 @@ func NewEventKey(k Key, ch rune, mod ModMask) *EventKey { // possible to report modifier keys. type ModMask int16 +// These are the modifiers keys that can be sent either with a key press, +// or a mouse event. const ( ModShift ModMask = 1 << iota ModCtrl ModAlt ModMeta + ModNone ModMask = 0 ) -const ModNone ModMask = 0 // Key is a generic value for representing keys, and especially special // keys (function keys, cursor movement keys, etc.) For normal keys, like @@ -275,6 +277,10 @@ const ModNone ModMask = 0 // inspect the Rune() member of the EventKey. type Key int16 +// This is the list of named keys. KeyRune is special however, in that it is +// a place holder key indicating that a printable character was sent. The +// actual value of the rune will be transported in the Rune of the associated +// EventKey. const ( KeyRune Key = iota + 256 KeyUp @@ -365,6 +371,8 @@ const ( KeyF64 ) +// These are the control keys. Note that they overlap with other keys, +// perhaps. For example, KeyCtrlH is the same as KeyBackspace. const ( KeyCtrlSpace Key = iota KeyCtrlA @@ -442,6 +450,7 @@ const ( KeyDEL Key = 0x7F ) +// These keys are aliases for other names. const ( KeyBackspace = KeyBS KeyTab = KeyTAB diff --git a/mouse.go b/mouse.go index 8221bd2..8c51c98 100644 --- a/mouse.go +++ b/mouse.go @@ -79,6 +79,7 @@ func NewEventMouse(x, y int, btn ButtonMask, mod ModMask) *EventMouse { // emulations (such as vt100) won't support mice at all, of course. type ButtonMask int16 +// These are the actual button values. const ( Button1 ButtonMask = 1 << iota // Usually left mouse button. Button2 // Usually the middle mouse button. diff --git a/runes.go b/runes.go index 483a4d5..ed9c63b 100644 --- a/runes.go +++ b/runes.go @@ -18,7 +18,6 @@ package tcell // modulo case, and changing the prefix from ACS_ to Rune. These are // the runes we provide extra special handling for, with ASCII fallbacks // for terminals that lack them. - const ( RuneSterling = '£' RuneDArrow = '↓' diff --git a/termbox/compat.go b/termbox/compat.go index 9fec7d9..08c6357 100644 --- a/termbox/compat.go +++ b/termbox/compat.go @@ -64,8 +64,11 @@ func Size() (int, int) { return screen.Size() } +// Attribute affects the presentation of characters, such as color, boldness, +// and so forth. type Attribute uint16 +// Colors first. The order here is significant. const ( ColorDefault Attribute = iota ColorBlack @@ -77,6 +80,8 @@ const ( ColorCyan ColorWhite ) + +// Other attributes. const ( AttrBold Attribute = 1 << (9 + iota) AttrUnderline @@ -139,6 +144,7 @@ func Clear(fg, bg Attribute) { // InputMode is not used. type InputMode int +// Unused input modes; here for compatibility. const ( InputCurrent InputMode = iota InputEsc @@ -156,6 +162,7 @@ func SetInputMode(mode InputMode) InputMode { // are used. See the termbox documentation for an explanation. type OutputMode int +// OutputMode values. const ( OutputCurrent OutputMode = iota OutputNormal @@ -216,6 +223,7 @@ type Event struct { N int } +// Event types. const ( EventNone EventType = iota EventKey @@ -226,6 +234,7 @@ const ( EventRaw ) +// Keys codes. const ( KeyF1 = Key(tcell.KeyF1) KeyF2 = Key(tcell.KeyF2) @@ -286,6 +295,7 @@ const ( MouseMiddle = Key(tcell.KeyF61) ) +// Modifiers. const ( ModAlt = Modifier(tcell.ModAlt) )