fixes #76 Set some comments on constant blocks to silence golint

This commit is contained in:
Garrett D'Amore 2015-11-04 19:18:59 -08:00
parent 9575857d57
commit c5d65ed603
6 changed files with 26 additions and 7 deletions

View File

@ -18,17 +18,15 @@ package tcell
// Note that support for attributes may vary widely across terminals. // Note that support for attributes may vary widely across terminals.
type AttrMask int 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 ( const (
AttrBold AttrMask = 1 << (25 + iota) AttrBold AttrMask = 1 << (25 + iota)
AttrBlink AttrBlink
AttrReverse AttrReverse
AttrUnderline AttrUnderline
AttrDim AttrDim
AttrNone AttrMask = 0 // Just normal text.
// AttrNone is just normal text.
AttrNone AttrMask = 0
) )
const attrAll = AttrBold | AttrBlink | AttrReverse | AttrUnderline | AttrDim const attrAll = AttrBold | AttrBlink | AttrReverse | AttrUnderline | AttrDim

View File

@ -423,6 +423,8 @@ const (
ColorYellowGreen ColorYellowGreen
) )
// These are aliases for the color gray, because some of us spell
// it as grey.
const ( const (
ColorGrey = ColorGray ColorGrey = ColorGray
ColorDimGrey = ColorDimGray ColorDimGrey = ColorDimGray

11
key.go
View File

@ -261,13 +261,15 @@ func NewEventKey(k Key, ch rune, mod ModMask) *EventKey {
// possible to report modifier keys. // possible to report modifier keys.
type ModMask int16 type ModMask int16
// These are the modifiers keys that can be sent either with a key press,
// or a mouse event.
const ( const (
ModShift ModMask = 1 << iota ModShift ModMask = 1 << iota
ModCtrl ModCtrl
ModAlt ModAlt
ModMeta ModMeta
ModNone ModMask = 0
) )
const ModNone ModMask = 0
// Key is a generic value for representing keys, and especially special // Key is a generic value for representing keys, and especially special
// keys (function keys, cursor movement keys, etc.) For normal keys, like // 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. // inspect the Rune() member of the EventKey.
type Key int16 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 ( const (
KeyRune Key = iota + 256 KeyRune Key = iota + 256
KeyUp KeyUp
@ -365,6 +371,8 @@ const (
KeyF64 KeyF64
) )
// These are the control keys. Note that they overlap with other keys,
// perhaps. For example, KeyCtrlH is the same as KeyBackspace.
const ( const (
KeyCtrlSpace Key = iota KeyCtrlSpace Key = iota
KeyCtrlA KeyCtrlA
@ -442,6 +450,7 @@ const (
KeyDEL Key = 0x7F KeyDEL Key = 0x7F
) )
// These keys are aliases for other names.
const ( const (
KeyBackspace = KeyBS KeyBackspace = KeyBS
KeyTab = KeyTAB KeyTab = KeyTAB

View File

@ -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. // emulations (such as vt100) won't support mice at all, of course.
type ButtonMask int16 type ButtonMask int16
// These are the actual button values.
const ( const (
Button1 ButtonMask = 1 << iota // Usually left mouse button. Button1 ButtonMask = 1 << iota // Usually left mouse button.
Button2 // Usually the middle mouse button. Button2 // Usually the middle mouse button.

View File

@ -18,7 +18,6 @@ package tcell
// modulo case, and changing the prefix from ACS_ to Rune. These are // modulo case, and changing the prefix from ACS_ to Rune. These are
// the runes we provide extra special handling for, with ASCII fallbacks // the runes we provide extra special handling for, with ASCII fallbacks
// for terminals that lack them. // for terminals that lack them.
const ( const (
RuneSterling = '£' RuneSterling = '£'
RuneDArrow = '↓' RuneDArrow = '↓'

View File

@ -64,8 +64,11 @@ func Size() (int, int) {
return screen.Size() return screen.Size()
} }
// Attribute affects the presentation of characters, such as color, boldness,
// and so forth.
type Attribute uint16 type Attribute uint16
// Colors first. The order here is significant.
const ( const (
ColorDefault Attribute = iota ColorDefault Attribute = iota
ColorBlack ColorBlack
@ -77,6 +80,8 @@ const (
ColorCyan ColorCyan
ColorWhite ColorWhite
) )
// Other attributes.
const ( const (
AttrBold Attribute = 1 << (9 + iota) AttrBold Attribute = 1 << (9 + iota)
AttrUnderline AttrUnderline
@ -139,6 +144,7 @@ func Clear(fg, bg Attribute) {
// InputMode is not used. // InputMode is not used.
type InputMode int type InputMode int
// Unused input modes; here for compatibility.
const ( const (
InputCurrent InputMode = iota InputCurrent InputMode = iota
InputEsc InputEsc
@ -156,6 +162,7 @@ func SetInputMode(mode InputMode) InputMode {
// are used. See the termbox documentation for an explanation. // are used. See the termbox documentation for an explanation.
type OutputMode int type OutputMode int
// OutputMode values.
const ( const (
OutputCurrent OutputMode = iota OutputCurrent OutputMode = iota
OutputNormal OutputNormal
@ -216,6 +223,7 @@ type Event struct {
N int N int
} }
// Event types.
const ( const (
EventNone EventType = iota EventNone EventType = iota
EventKey EventKey
@ -226,6 +234,7 @@ const (
EventRaw EventRaw
) )
// Keys codes.
const ( const (
KeyF1 = Key(tcell.KeyF1) KeyF1 = Key(tcell.KeyF1)
KeyF2 = Key(tcell.KeyF2) KeyF2 = Key(tcell.KeyF2)
@ -286,6 +295,7 @@ const (
MouseMiddle = Key(tcell.KeyF61) MouseMiddle = Key(tcell.KeyF61)
) )
// Modifiers.
const ( const (
ModAlt = Modifier(tcell.ModAlt) ModAlt = Modifier(tcell.ModAlt)
) )