mirror of
https://github.com/gdamore/tcell.git
synced 2025-04-24 13:48:51 +08:00
go fmt compliance fixes
This commit is contained in:
parent
b187e6250e
commit
8b8ed1d164
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2015 The TCell Authors
|
// Copyright 2015 The TCell Authors
|
||||||
@ -46,7 +47,7 @@ func makebox(s tcell.Screen) {
|
|||||||
rgb := tcell.NewHexColor(int32(rand.Int() & 0xffffff))
|
rgb := tcell.NewHexColor(int32(rand.Int() & 0xffffff))
|
||||||
st = st.Background(rgb)
|
st = st.Background(rgb)
|
||||||
} else if s.Colors() > 1 {
|
} else if s.Colors() > 1 {
|
||||||
st = st.Background(tcell.Color(rand.Int() % s.Colors()) | tcell.ColorValid)
|
st = st.Background(tcell.Color(rand.Int()%s.Colors()) | tcell.ColorValid)
|
||||||
} else {
|
} else {
|
||||||
st = st.Reverse(rand.Int()%2 == 0)
|
st = st.Reverse(rand.Int()%2 == 0)
|
||||||
gl = glyphs[rand.Int()%len(glyphs)]
|
gl = glyphs[rand.Int()%len(glyphs)]
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2020 The TCell Authors
|
// Copyright 2020 The TCell Authors
|
||||||
|
@ -290,7 +290,7 @@ func main() {
|
|||||||
switch ev.Buttons() {
|
switch ev.Buttons() {
|
||||||
case tcell.ButtonNone:
|
case tcell.ButtonNone:
|
||||||
if ox >= 0 {
|
if ox >= 0 {
|
||||||
bg := theme[(lchar-'0') % 8]
|
bg := theme[(lchar-'0')%8]
|
||||||
fg := tcell.ColorBlack
|
fg := tcell.ColorBlack
|
||||||
drawBox(s, ox, oy, x, y,
|
drawBox(s, ox, oy, x, y,
|
||||||
up.Background(bg).Foreground(fg),
|
up.Background(bg).Foreground(fg),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2019 The TCell Authors
|
// Copyright 2019 The TCell Authors
|
||||||
|
@ -1217,8 +1217,7 @@ const (
|
|||||||
modeCookedOut uint32 = 0x0001
|
modeCookedOut uint32 = 0x0001
|
||||||
modeVtOutput = 0x0004
|
modeVtOutput = 0x0004
|
||||||
modeNoAutoNL = 0x0008
|
modeNoAutoNL = 0x0008
|
||||||
// ENABLE_LVB_GRID_WORLDWIDE, needed to make underlines actually work.
|
modeUnderline = 0x0010 // ENABLE_LVB_GRID_WORLDWIDE, needed for underlines
|
||||||
modeUnderline = 0x0010
|
|
||||||
// modeWrapEOL = 0x0002
|
// modeWrapEOL = 0x0002
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ var encodingFallback EncodingFallback = EncodingFallbackFail
|
|||||||
|
|
||||||
// The East Asian encodings have been seen to add 100-200K per encoding to the
|
// The East Asian encodings have been seen to add 100-200K per encoding to the
|
||||||
// size of the resulting binary.
|
// size of the resulting binary.
|
||||||
//
|
|
||||||
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)
|
||||||
|
@ -126,5 +126,5 @@ func registerAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
registerAll();
|
registerAll()
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// you may not use file except in compliance with the License.
|
// you may not use file except in compliance with the License.
|
||||||
// You may obtain a copy of the license at
|
// You may obtain a copy of the license at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@ -20,8 +20,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func ExampleRegisterEncoding() {
|
func ExampleRegisterEncoding() {
|
||||||
RegisterEncoding("GBK", simplifiedchinese.GBK);
|
RegisterEncoding("GBK", simplifiedchinese.GBK)
|
||||||
enc := GetEncoding("GBK");
|
enc := GetEncoding("GBK")
|
||||||
glyph, _ := enc.NewDecoder().Bytes([]byte{0x82, 0x74})
|
glyph, _ := enc.NewDecoder().Bytes([]byte{0x82, 0x74})
|
||||||
fmt.Println(string(glyph))
|
fmt.Println(string(glyph))
|
||||||
// Output: 倀
|
// Output: 倀
|
||||||
|
@ -349,8 +349,8 @@ func (t *tScreen) prepareBracketedPaste() {
|
|||||||
func (t *tScreen) prepareExtendedOSC() {
|
func (t *tScreen) prepareExtendedOSC() {
|
||||||
// Linux is a special beast - because it has a mouse entry, but does
|
// Linux is a special beast - because it has a mouse entry, but does
|
||||||
// not swallow these OSC commands properly.
|
// not swallow these OSC commands properly.
|
||||||
if (strings.Contains(t.ti.Name, "linux")) {
|
if strings.Contains(t.ti.Name, "linux") {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
// More stuff for limits in terminfo. This time we are applying
|
// More stuff for limits in terminfo. This time we are applying
|
||||||
// the most common OSC (operating system commands). Generally
|
// the most common OSC (operating system commands). Generally
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2016 The Tcell Authors
|
// Copyright 2016 The Tcell Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2015 The Tops'l Authors
|
// Copyright 2015 The Tops'l Authors
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// Copyright 2015 The Tops'l Authors
|
// Copyright 2015 The Tops'l Authors
|
||||||
|
44
wscreen.go
44
wscreen.go
@ -115,29 +115,29 @@ func (t *wScreen) SetCell(x, y int, style Style, ch ...rune) {
|
|||||||
// via CSS.
|
// via CSS.
|
||||||
|
|
||||||
var palette = map[Color]int32{
|
var palette = map[Color]int32{
|
||||||
ColorBlack: 0x000000,
|
ColorBlack: 0x000000,
|
||||||
ColorMaroon: 0xcd0000,
|
ColorMaroon: 0xcd0000,
|
||||||
ColorGreen: 0x00cd00,
|
ColorGreen: 0x00cd00,
|
||||||
ColorOlive: 0xcdcd00,
|
ColorOlive: 0xcdcd00,
|
||||||
ColorNavy: 0x0000ee,
|
ColorNavy: 0x0000ee,
|
||||||
ColorPurple: 0xcd00cd,
|
ColorPurple: 0xcd00cd,
|
||||||
ColorTeal: 0x00cdcd,
|
ColorTeal: 0x00cdcd,
|
||||||
ColorSilver: 0xe5e5e5,
|
ColorSilver: 0xe5e5e5,
|
||||||
ColorGray: 0x7f7f7f,
|
ColorGray: 0x7f7f7f,
|
||||||
ColorRed: 0xff0000,
|
ColorRed: 0xff0000,
|
||||||
ColorLime: 0x00ff00,
|
ColorLime: 0x00ff00,
|
||||||
ColorYellow: 0xffff00,
|
ColorYellow: 0xffff00,
|
||||||
ColorBlue: 0x5c5cff,
|
ColorBlue: 0x5c5cff,
|
||||||
ColorFuchsia: 0xff00ff,
|
ColorFuchsia: 0xff00ff,
|
||||||
ColorAqua: 0x00ffff,
|
ColorAqua: 0x00ffff,
|
||||||
ColorWhite: 0xffffff,
|
ColorWhite: 0xffffff,
|
||||||
}
|
}
|
||||||
|
|
||||||
func paletteColor(c Color) int32 {
|
func paletteColor(c Color) int32 {
|
||||||
if (c.IsRGB()) {
|
if c.IsRGB() {
|
||||||
return int32(c & 0xffffff);
|
return int32(c & 0xffffff)
|
||||||
}
|
}
|
||||||
if (c >= ColorBlack && c <= ColorWhite) {
|
if c >= ColorBlack && c <= ColorWhite {
|
||||||
return palette[c]
|
return palette[c]
|
||||||
}
|
}
|
||||||
return c.Hex()
|
return c.Hex()
|
||||||
@ -155,11 +155,11 @@ func (t *wScreen) drawCell(x, y int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fg, bg := paletteColor(style.fg), paletteColor(style.bg)
|
fg, bg := paletteColor(style.fg), paletteColor(style.bg)
|
||||||
if (fg == -1) {
|
if fg == -1 {
|
||||||
fg = 0xe5e5e5;
|
fg = 0xe5e5e5
|
||||||
}
|
}
|
||||||
if (bg == -1) {
|
if bg == -1 {
|
||||||
bg = 0x000000;
|
bg = 0x000000
|
||||||
}
|
}
|
||||||
|
|
||||||
var combcarr []interface{} = make([]interface{}, len(combc))
|
var combcarr []interface{} = make([]interface{}, len(combc))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user