mirror of
https://github.com/gdamore/tcell.git
synced 2025-04-24 13:48:51 +08:00
Go fmt for the project.
This commit is contained in:
parent
3f5bfde5ba
commit
d25117a2e5
@ -1,3 +1,4 @@
|
|||||||
|
//go:build plan9 || nacl
|
||||||
// +build plan9 nacl
|
// +build plan9 nacl
|
||||||
|
|
||||||
// Copyright 2015 The TCell Authors
|
// Copyright 2015 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build !windows && !nacl && !plan9
|
||||||
// +build !windows,!nacl,!plan9
|
// +build !windows,!nacl,!plan9
|
||||||
|
|
||||||
// Copyright 2016 The TCell Authors
|
// Copyright 2016 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
|
|
||||||
// Copyright 2015 The TCell Authors
|
// Copyright 2015 The TCell Authors
|
||||||
|
@ -90,11 +90,11 @@ func TestColorNameLookup(t *testing.T) {
|
|||||||
t.Errorf("Wrong color for %v: %v", v.name, c.Hex())
|
t.Errorf("Wrong color for %v: %v", v.name, c.Hex())
|
||||||
}
|
}
|
||||||
if v.rgb {
|
if v.rgb {
|
||||||
if c & ColorIsRGB == 0 {
|
if c&ColorIsRGB == 0 {
|
||||||
t.Errorf("Color should have RGB")
|
t.Errorf("Color should have RGB")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if c & ColorIsRGB != 0 {
|
if c&ColorIsRGB != 0 {
|
||||||
t.Errorf("Named color should not be RGB")
|
t.Errorf("Named color should not be RGB")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
// Copyright 2015 The TCell Authors
|
// Copyright 2015 The TCell Authors
|
||||||
|
1
doc.go
1
doc.go
@ -44,5 +44,4 @@
|
|||||||
//
|
//
|
||||||
// A rich set of keycodes is supported, with support for up to 65 function
|
// A rich set of keycodes is supported, with support for up to 65 function
|
||||||
// keys, and various other special keys.
|
// keys, and various other special keys.
|
||||||
//
|
|
||||||
package tcell
|
package tcell
|
||||||
|
@ -38,10 +38,10 @@ var encodingFallback EncodingFallback = EncodingFallbackFail
|
|||||||
// the common ones exist already as stock variables. For example, ISO8859-15
|
// the common ones exist already as stock variables. For example, ISO8859-15
|
||||||
// can be registered using the following code:
|
// 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
|
// Aliases can be registered as well, for example "8859-15" could be an alias
|
||||||
// for "ISO8859-15".
|
// 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.
|
// LC_ALL, LC_CTYPE, and LANG (in that order) to determine the character set.
|
||||||
// These are expected to have the following pattern:
|
// 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
|
// 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"
|
// 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
|
// 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
|
// 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.
|
// have been seen to add 100-200K per encoding to the application size.
|
||||||
//
|
|
||||||
func RegisterEncoding(charset string, enc encoding.Encoding) {
|
func RegisterEncoding(charset string, enc encoding.Encoding) {
|
||||||
encodingLk.Lock()
|
encodingLk.Lock()
|
||||||
charset = strings.ToLower(charset)
|
charset = strings.ToLower(charset)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd
|
// +build darwin dragonfly freebsd netbsd openbsd
|
||||||
|
|
||||||
package tcell
|
package tcell
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
//go:build linux || aix || zos || solaris
|
||||||
// +build linux aix zos solaris
|
// +build linux aix zos solaris
|
||||||
|
|
||||||
package tcell
|
package tcell
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package tcell
|
package tcell
|
||||||
@ -162,7 +163,7 @@ func (tty *stdIoTty) NotifyResize(cb func()) {
|
|||||||
func NewStdIoTty() (Tty, error) {
|
func NewStdIoTty() (Tty, error) {
|
||||||
tty := &stdIoTty{
|
tty := &stdIoTty{
|
||||||
sig: make(chan os.Signal),
|
sig: make(chan os.Signal),
|
||||||
in: os.Stdin,
|
in: os.Stdin,
|
||||||
out: os.Stdout,
|
out: os.Stdout,
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
@ -8,63 +8,63 @@ func init() {
|
|||||||
|
|
||||||
// foot terminal emulator
|
// foot terminal emulator
|
||||||
terminfo.AddTerminfo(&terminfo.Terminfo{
|
terminfo.AddTerminfo(&terminfo.Terminfo{
|
||||||
Name: "foot",
|
Name: "foot",
|
||||||
Aliases: []string{"foot-extra"},
|
Aliases: []string{"foot-extra"},
|
||||||
Columns: 80,
|
Columns: 80,
|
||||||
Lines: 24,
|
Lines: 24,
|
||||||
Colors: 256,
|
Colors: 256,
|
||||||
Bell: "\a",
|
Bell: "\a",
|
||||||
Clear: "\x1b[H\x1b[2J",
|
Clear: "\x1b[H\x1b[2J",
|
||||||
EnterCA: "\x1b[?1049h\x1b[22;0;0t",
|
EnterCA: "\x1b[?1049h\x1b[22;0;0t",
|
||||||
ExitCA: "\x1b[?1049l\x1b[23;0;0t",
|
ExitCA: "\x1b[?1049l\x1b[23;0;0t",
|
||||||
ShowCursor: "\x1b[?12l\x1b[?25h",
|
ShowCursor: "\x1b[?12l\x1b[?25h",
|
||||||
HideCursor: "\x1b[?25l",
|
HideCursor: "\x1b[?25l",
|
||||||
AttrOff: "\x1b(B\x1b[m",
|
AttrOff: "\x1b(B\x1b[m",
|
||||||
Underline: "\x1b[4m",
|
Underline: "\x1b[4m",
|
||||||
Bold: "\x1b[1m",
|
Bold: "\x1b[1m",
|
||||||
Dim: "\x1b[2m",
|
Dim: "\x1b[2m",
|
||||||
Italic: "\x1b[3m",
|
Italic: "\x1b[3m",
|
||||||
Blink: "\x1b[5m",
|
Blink: "\x1b[5m",
|
||||||
Reverse: "\x1b[7m",
|
Reverse: "\x1b[7m",
|
||||||
EnterKeypad: "\x1b[?1h\x1b=",
|
EnterKeypad: "\x1b[?1h\x1b=",
|
||||||
ExitKeypad: "\x1b[?1l\x1b>",
|
ExitKeypad: "\x1b[?1l\x1b>",
|
||||||
SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38:5:%p1%d%;m",
|
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",
|
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",
|
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",
|
ResetFgBg: "\x1b[39;49m",
|
||||||
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
|
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
|
||||||
EnterAcs: "\x1b(0",
|
EnterAcs: "\x1b(0",
|
||||||
ExitAcs: "\x1b(B",
|
ExitAcs: "\x1b(B",
|
||||||
StrikeThrough: "\x1b[9m",
|
StrikeThrough: "\x1b[9m",
|
||||||
Mouse: "\x1b[M",
|
Mouse: "\x1b[M",
|
||||||
SetCursor: "\x1b[%i%p1%d;%p2%dH",
|
SetCursor: "\x1b[%i%p1%d;%p2%dH",
|
||||||
CursorBack1: "\b",
|
CursorBack1: "\b",
|
||||||
CursorUp1: "\x1b[A",
|
CursorUp1: "\x1b[A",
|
||||||
KeyUp: "\x1bOA",
|
KeyUp: "\x1bOA",
|
||||||
KeyDown: "\x1bOB",
|
KeyDown: "\x1bOB",
|
||||||
KeyRight: "\x1bOC",
|
KeyRight: "\x1bOC",
|
||||||
KeyLeft: "\x1bOD",
|
KeyLeft: "\x1bOD",
|
||||||
KeyInsert: "\x1b[2~",
|
KeyInsert: "\x1b[2~",
|
||||||
KeyDelete: "\x1b[3~",
|
KeyDelete: "\x1b[3~",
|
||||||
KeyBackspace: "\u007f",
|
KeyBackspace: "\u007f",
|
||||||
KeyHome: "\x1bOH",
|
KeyHome: "\x1bOH",
|
||||||
KeyEnd: "\x1bOF",
|
KeyEnd: "\x1bOF",
|
||||||
KeyPgUp: "\x1b[5~",
|
KeyPgUp: "\x1b[5~",
|
||||||
KeyPgDn: "\x1b[6~",
|
KeyPgDn: "\x1b[6~",
|
||||||
KeyF1: "\x1bOP",
|
KeyF1: "\x1bOP",
|
||||||
KeyF2: "\x1bOQ",
|
KeyF2: "\x1bOQ",
|
||||||
KeyF3: "\x1bOR",
|
KeyF3: "\x1bOR",
|
||||||
KeyF4: "\x1bOS",
|
KeyF4: "\x1bOS",
|
||||||
KeyF5: "\x1b[15~",
|
KeyF5: "\x1b[15~",
|
||||||
KeyF6: "\x1b[17~",
|
KeyF6: "\x1b[17~",
|
||||||
KeyF7: "\x1b[18~",
|
KeyF7: "\x1b[18~",
|
||||||
KeyF8: "\x1b[19~",
|
KeyF8: "\x1b[19~",
|
||||||
KeyF9: "\x1b[20~",
|
KeyF9: "\x1b[20~",
|
||||||
KeyF10: "\x1b[21~",
|
KeyF10: "\x1b[21~",
|
||||||
KeyF11: "\x1b[23~",
|
KeyF11: "\x1b[23~",
|
||||||
KeyF12: "\x1b[24~",
|
KeyF12: "\x1b[24~",
|
||||||
KeyBacktab: "\x1b[Z",
|
KeyBacktab: "\x1b[Z",
|
||||||
Modifiers: 1,
|
Modifiers: 1,
|
||||||
AutoMargin: true,
|
AutoMargin: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2021 The TCell Authors
|
// Copyright 2021 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build !tcell_minimal
|
||||||
// +build !tcell_minimal
|
// +build !tcell_minimal
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build !tcell_minimal && !nacl && !js && !zos && !plan9 && !windows && !android
|
||||||
// +build !tcell_minimal,!nacl,!js,!zos,!plan9,!windows,!android
|
// +build !tcell_minimal,!nacl,!js,!zos,!plan9,!windows,!android
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build tcell_minimal || nacl || js || zos || plan9 || windows || android
|
||||||
// +build tcell_minimal nacl js zos plan9 windows android
|
// +build tcell_minimal nacl js zos plan9 windows android
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build js || plan9 || windows
|
||||||
// +build js plan9 windows
|
// +build js plan9 windows
|
||||||
|
|
||||||
// Copyright 2021 The TCell Authors
|
// Copyright 2021 The TCell Authors
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package tcell
|
package tcell
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package tcell
|
package tcell
|
||||||
|
@ -21,13 +21,13 @@ package views
|
|||||||
// Only the content pane is resizable. The panel will be formatted
|
// Only the content pane is resizable. The panel will be formatted
|
||||||
// like this:
|
// like this:
|
||||||
//
|
//
|
||||||
// +----------
|
// +----------
|
||||||
// | title
|
// | title
|
||||||
// | menu
|
// | menu
|
||||||
// | content....
|
// | content....
|
||||||
// | <padding>
|
// | <padding>
|
||||||
// | status
|
// | status
|
||||||
// +----------
|
// +----------
|
||||||
//
|
//
|
||||||
// Each of these components may be any valid widget; their names are
|
// Each of these components may be any valid widget; their names are
|
||||||
// only meant to be indicative of conventional use, not prescriptive.
|
// only meant to be indicative of conventional use, not prescriptive.
|
||||||
|
@ -90,7 +90,7 @@ func (m *linesModel) GetCursor() (int, int, bool, bool) {
|
|||||||
func (ta *TextArea) SetLines(lines []string) {
|
func (ta *TextArea) SetLines(lines []string) {
|
||||||
ta.Init()
|
ta.Init()
|
||||||
m := ta.model
|
m := ta.model
|
||||||
m.width =0
|
m.width = 0
|
||||||
|
|
||||||
// extend slice before using m.runes[row] to avoid panic
|
// extend slice before using m.runes[row] to avoid panic
|
||||||
slice := make([][]rune, len(lines))
|
slice := make([][]rune, len(lines))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user