diff --git a/charset_stub.go b/charset_stub.go index c1c1594..ec4d260 100644 --- a/charset_stub.go +++ b/charset_stub.go @@ -1,3 +1,4 @@ +//go:build plan9 || nacl // +build plan9 nacl // Copyright 2015 The TCell Authors diff --git a/charset_unix.go b/charset_unix.go index d9f9d8e..8bbf1f5 100644 --- a/charset_unix.go +++ b/charset_unix.go @@ -1,3 +1,4 @@ +//go:build !windows && !nacl && !plan9 // +build !windows,!nacl,!plan9 // Copyright 2016 The TCell Authors diff --git a/charset_windows.go b/charset_windows.go index 2400aa8..08068a0 100644 --- a/charset_windows.go +++ b/charset_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows // Copyright 2015 The TCell Authors diff --git a/color_test.go b/color_test.go index d0e1ce0..91725b7 100644 --- a/color_test.go +++ b/color_test.go @@ -90,11 +90,11 @@ func TestColorNameLookup(t *testing.T) { t.Errorf("Wrong color for %v: %v", v.name, c.Hex()) } if v.rgb { - if c & ColorIsRGB == 0 { + if c&ColorIsRGB == 0 { t.Errorf("Color should have RGB") } } else { - if c & ColorIsRGB != 0 { + if c&ColorIsRGB != 0 { t.Errorf("Named color should not be RGB") } } diff --git a/console_stub.go b/console_stub.go index fda2f09..6ff7e92 100644 --- a/console_stub.go +++ b/console_stub.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows // Copyright 2015 The TCell Authors diff --git a/doc.go b/doc.go index b671961..857e37a 100644 --- a/doc.go +++ b/doc.go @@ -44,5 +44,4 @@ // // A rich set of keycodes is supported, with support for up to 65 function // keys, and various other special keys. -// package tcell diff --git a/encoding.go b/encoding.go index 596a6e8..76c1089 100644 --- a/encoding.go +++ b/encoding.go @@ -38,10 +38,10 @@ var encodingFallback EncodingFallback = EncodingFallbackFail // the common ones exist already as stock variables. For example, ISO8859-15 // can be registered using the following code: // -// import "golang.org/x/text/encoding/charmap" +// import "golang.org/x/text/encoding/charmap" // -// ... -// RegisterEncoding("ISO8859-15", charmap.ISO8859_15) +// ... +// RegisterEncoding("ISO8859-15", charmap.ISO8859_15) // // Aliases can be registered as well, for example "8859-15" could be an alias // for "ISO8859-15". @@ -50,7 +50,7 @@ var encodingFallback EncodingFallback = EncodingFallbackFail // LC_ALL, LC_CTYPE, and LANG (in that order) to determine the character set. // These are expected to have the following pattern: // -// $language[.$codeset[@$variant] +// $language[.$codeset[@$variant] // // We extract only the $codeset part, which will usually be something like // UTF-8 or ISO8859-15 or KOI8-R. Note that if the locale is either "POSIX" @@ -67,7 +67,6 @@ var encodingFallback EncodingFallback = EncodingFallbackFail // superset of Unicode) and so the application size can be expected ot // increase quite a bit as each encoding is added. The East Asian encodings // have been seen to add 100-200K per encoding to the application size. -// func RegisterEncoding(charset string, enc encoding.Encoding) { encodingLk.Lock() charset = strings.ToLower(charset) diff --git a/nonblock_bsd.go b/nonblock_bsd.go index 28fd464..622888e 100644 --- a/nonblock_bsd.go +++ b/nonblock_bsd.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin || dragonfly || freebsd || netbsd || openbsd // +build darwin dragonfly freebsd netbsd openbsd package tcell diff --git a/nonblock_unix.go b/nonblock_unix.go index fe31844..160a641 100644 --- a/nonblock_unix.go +++ b/nonblock_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build linux || aix || zos || solaris // +build linux aix zos solaris package tcell diff --git a/stdin_unix.go b/stdin_unix.go index e3d32e9..b9be7f1 100644 --- a/stdin_unix.go +++ b/stdin_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package tcell @@ -162,7 +163,7 @@ func (tty *stdIoTty) NotifyResize(cb func()) { func NewStdIoTty() (Tty, error) { tty := &stdIoTty{ sig: make(chan os.Signal), - in: os.Stdin, + in: os.Stdin, out: os.Stdout, } var err error diff --git a/terminfo/f/foot/foot.go b/terminfo/f/foot/foot.go index 3197d82..5daa3c8 100644 --- a/terminfo/f/foot/foot.go +++ b/terminfo/f/foot/foot.go @@ -8,63 +8,63 @@ func init() { // foot terminal emulator terminfo.AddTerminfo(&terminfo.Terminfo{ - Name: "foot", - Aliases: []string{"foot-extra"}, - Columns: 80, - Lines: 24, - Colors: 256, - Bell: "\a", - Clear: "\x1b[H\x1b[2J", - EnterCA: "\x1b[?1049h\x1b[22;0;0t", - ExitCA: "\x1b[?1049l\x1b[23;0;0t", - ShowCursor: "\x1b[?12l\x1b[?25h", - HideCursor: "\x1b[?25l", - AttrOff: "\x1b(B\x1b[m", - Underline: "\x1b[4m", - Bold: "\x1b[1m", - Dim: "\x1b[2m", - Italic: "\x1b[3m", - Blink: "\x1b[5m", - Reverse: "\x1b[7m", - EnterKeypad: "\x1b[?1h\x1b=", - ExitKeypad: "\x1b[?1l\x1b>", - SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;m", - SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48:5:%p1%d%;m", - SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48:5:%p2%d%;m", - ResetFgBg: "\x1b[39;49m", - AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", - EnterAcs: "\x1b(0", - ExitAcs: "\x1b(B", + Name: "foot", + Aliases: []string{"foot-extra"}, + Columns: 80, + Lines: 24, + Colors: 256, + Bell: "\a", + Clear: "\x1b[H\x1b[2J", + EnterCA: "\x1b[?1049h\x1b[22;0;0t", + ExitCA: "\x1b[?1049l\x1b[23;0;0t", + ShowCursor: "\x1b[?12l\x1b[?25h", + HideCursor: "\x1b[?25l", + AttrOff: "\x1b(B\x1b[m", + Underline: "\x1b[4m", + Bold: "\x1b[1m", + Dim: "\x1b[2m", + Italic: "\x1b[3m", + Blink: "\x1b[5m", + Reverse: "\x1b[7m", + EnterKeypad: "\x1b[?1h\x1b=", + ExitKeypad: "\x1b[?1l\x1b>", + SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;m", + SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48:5:%p1%d%;m", + SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48:5:%p2%d%;m", + ResetFgBg: "\x1b[39;49m", + AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", + EnterAcs: "\x1b(0", + ExitAcs: "\x1b(B", StrikeThrough: "\x1b[9m", - Mouse: "\x1b[M", - SetCursor: "\x1b[%i%p1%d;%p2%dH", - CursorBack1: "\b", - CursorUp1: "\x1b[A", - KeyUp: "\x1bOA", - KeyDown: "\x1bOB", - KeyRight: "\x1bOC", - KeyLeft: "\x1bOD", - KeyInsert: "\x1b[2~", - KeyDelete: "\x1b[3~", - KeyBackspace: "\u007f", - KeyHome: "\x1bOH", - KeyEnd: "\x1bOF", - KeyPgUp: "\x1b[5~", - KeyPgDn: "\x1b[6~", - KeyF1: "\x1bOP", - KeyF2: "\x1bOQ", - KeyF3: "\x1bOR", - KeyF4: "\x1bOS", - KeyF5: "\x1b[15~", - KeyF6: "\x1b[17~", - KeyF7: "\x1b[18~", - KeyF8: "\x1b[19~", - KeyF9: "\x1b[20~", - KeyF10: "\x1b[21~", - KeyF11: "\x1b[23~", - KeyF12: "\x1b[24~", - KeyBacktab: "\x1b[Z", - Modifiers: 1, - AutoMargin: true, + Mouse: "\x1b[M", + SetCursor: "\x1b[%i%p1%d;%p2%dH", + CursorBack1: "\b", + CursorUp1: "\x1b[A", + KeyUp: "\x1bOA", + KeyDown: "\x1bOB", + KeyRight: "\x1bOC", + KeyLeft: "\x1bOD", + KeyInsert: "\x1b[2~", + KeyDelete: "\x1b[3~", + KeyBackspace: "\u007f", + KeyHome: "\x1bOH", + KeyEnd: "\x1bOF", + KeyPgUp: "\x1b[5~", + KeyPgDn: "\x1b[6~", + KeyF1: "\x1bOP", + KeyF2: "\x1bOQ", + KeyF3: "\x1bOR", + KeyF4: "\x1bOS", + KeyF5: "\x1b[15~", + KeyF6: "\x1b[17~", + KeyF7: "\x1b[18~", + KeyF8: "\x1b[19~", + KeyF9: "\x1b[20~", + KeyF10: "\x1b[21~", + KeyF11: "\x1b[23~", + KeyF12: "\x1b[24~", + KeyBacktab: "\x1b[Z", + Modifiers: 1, + AutoMargin: true, }) } diff --git a/terminfo/mkinfo.go b/terminfo/mkinfo.go index 188183c..3f57abd 100644 --- a/terminfo/mkinfo.go +++ b/terminfo/mkinfo.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore // Copyright 2021 The TCell Authors diff --git a/terms_default.go b/terms_default.go index 4ce7637..fefcf89 100644 --- a/terms_default.go +++ b/terms_default.go @@ -1,3 +1,4 @@ +//go:build !tcell_minimal // +build !tcell_minimal // Copyright 2019 The TCell Authors diff --git a/terms_dynamic.go b/terms_dynamic.go index 8f0994a..f552b0e 100644 --- a/terms_dynamic.go +++ b/terms_dynamic.go @@ -1,3 +1,4 @@ +//go:build !tcell_minimal && !nacl && !js && !zos && !plan9 && !windows && !android // +build !tcell_minimal,!nacl,!js,!zos,!plan9,!windows,!android // Copyright 2019 The TCell Authors diff --git a/terms_static.go b/terms_static.go index 8b3fe12..d0c57d9 100644 --- a/terms_static.go +++ b/terms_static.go @@ -1,3 +1,4 @@ +//go:build tcell_minimal || nacl || js || zos || plan9 || windows || android // +build tcell_minimal nacl js zos plan9 windows android // Copyright 2019 The TCell Authors diff --git a/tscreen_stub.go b/tscreen_stub.go index 1611cb5..341175b 100644 --- a/tscreen_stub.go +++ b/tscreen_stub.go @@ -1,3 +1,4 @@ +//go:build js || plan9 || windows // +build js plan9 windows // Copyright 2021 The TCell Authors diff --git a/tscreen_unix.go b/tscreen_unix.go index 1eb7504..84727f8 100644 --- a/tscreen_unix.go +++ b/tscreen_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package tcell diff --git a/tty.go b/tty.go index 567b041..1e7c02e 100644 --- a/tty.go +++ b/tty.go @@ -53,4 +53,4 @@ type Tty interface { WindowSize() (width int, height int, err error) io.ReadWriteCloser -} \ No newline at end of file +} diff --git a/tty_unix.go b/tty_unix.go index aa6b7d5..05d5a7d 100644 --- a/tty_unix.go +++ b/tty_unix.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package tcell diff --git a/views/panel.go b/views/panel.go index 9d46bb3..eadb6a4 100644 --- a/views/panel.go +++ b/views/panel.go @@ -21,13 +21,13 @@ package views // Only the content pane is resizable. The panel will be formatted // like this: // -// +---------- -// | title -// | menu -// | content.... -// | -// | status -// +---------- +// +---------- +// | title +// | menu +// | content.... +// | +// | status +// +---------- // // Each of these components may be any valid widget; their names are // only meant to be indicative of conventional use, not prescriptive. diff --git a/views/textarea.go b/views/textarea.go index 2f19c66..8925b23 100644 --- a/views/textarea.go +++ b/views/textarea.go @@ -90,7 +90,7 @@ func (m *linesModel) GetCursor() (int, int, bool, bool) { func (ta *TextArea) SetLines(lines []string) { ta.Init() m := ta.model - m.width =0 + m.width = 0 // extend slice before using m.runes[row] to avoid panic slice := make([][]rune, len(lines))