Fix some lint error
This commit is contained in:
parent
daed321447
commit
fb5dba0e0d
@ -11,11 +11,11 @@ func TestBisectRight(t *testing.T) {
|
||||
|
||||
r := BisectRight(in, 0)
|
||||
if r != 0 {
|
||||
t.Error("number 0 should inserted at 0 position, but got %d", r)
|
||||
t.Errorf("number 0 should inserted at 0 position, but got %d", r)
|
||||
}
|
||||
|
||||
r = BisectRight(in, 4)
|
||||
if r != 5 {
|
||||
t.Error("number 4 should inserted at 5 position, but got %d", r)
|
||||
t.Errorf("number 4 should inserted at 5 position, but got %d", r)
|
||||
}
|
||||
}
|
||||
|
@ -324,12 +324,12 @@ func TestDocument_OnLastLine(t *testing.T) {
|
||||
CursorPosition: len("line 1\nline"),
|
||||
}
|
||||
ac := d.OnLastLine()
|
||||
if ac != false {
|
||||
if ac {
|
||||
t.Errorf("Should be %#v, got %#v", false, ac)
|
||||
}
|
||||
d.CursorPosition = len("line 1\nline 2\nline")
|
||||
ac = d.OnLastLine()
|
||||
if ac != true {
|
||||
if !ac {
|
||||
t.Errorf("Should be %#v, got %#v", true, ac)
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func (t *VT100Parser) setRawMode() error {
|
||||
n.Lflag &^= syscall.ECHO | syscall.ICANON | syscall.IEXTEN | syscall.ISIG
|
||||
n.Cc[syscall.VMIN] = 1
|
||||
n.Cc[syscall.VTIME] = 0
|
||||
termios.Tcsetattr(uintptr(t.fd), termios.TCSANOW, (*syscall.Termios)(&n))
|
||||
termios.Tcsetattr(uintptr(t.fd), termios.TCSANOW, &n)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ func (t *VT100Parser) resetRawMode() error {
|
||||
|
||||
func (t *VT100Parser) GetKey(b []byte) Key {
|
||||
for _, k := range asciiSequences {
|
||||
if bytes.Compare(k.ASCIICode, b) == 0 {
|
||||
if bytes.Equal(k.ASCIICode, b) {
|
||||
return k.Key
|
||||
}
|
||||
}
|
||||
|
@ -195,11 +195,11 @@ func (w *VT100Writer) ClearTitle() {
|
||||
func (w *VT100Writer) SetColor(fg, bg Color, bold bool) {
|
||||
f, ok := foregroundANSIColors[fg]
|
||||
if !ok {
|
||||
f, _ = foregroundANSIColors[DefaultColor]
|
||||
f = foregroundANSIColors[DefaultColor]
|
||||
}
|
||||
b, ok := backgroundANSIColors[bg]
|
||||
if !ok {
|
||||
b, _ = backgroundANSIColors[DefaultColor]
|
||||
b = backgroundANSIColors[DefaultColor]
|
||||
}
|
||||
syscall.Write(syscall.Stdout, []byte{0x1b, 0x5b, 0x33, 0x39, 0x3b, 0x34, 0x39, 0x6d})
|
||||
w.WriteRaw([]byte{0x1b, 0x5b})
|
||||
|
Loading…
Reference in New Issue
Block a user