Fix some issues reported by staticcheck

This commit is contained in:
Kovid Goyal 2022-09-21 19:10:57 +05:30
parent d6f42a11d7
commit ef49634353
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 4 additions and 7 deletions

View File

@ -93,7 +93,6 @@ func read_from_tty(pipe_r *os.File, term *tty.Term, results_channel chan<- []byt
case results_channel <- send:
case <-quit_channel:
keep_going = false
break
}
}
}

View File

@ -209,7 +209,7 @@ func flush_writer(pipe_w *os.File, tty_write_channel chan<- *write_msg, write_do
}()
deadline := time.Now().Add(timeout)
for len(pending_writes) > 0 && !writer_quit {
timeout = deadline.Sub(time.Now())
timeout = time.Until(deadline)
if timeout <= 0 {
return
}
@ -219,7 +219,6 @@ func flush_writer(pipe_w *os.File, tty_write_channel chan<- *write_msg, write_do
case _, more := <-write_done_channel:
if !more {
writer_quit = true
break
}
case tty_write_channel <- pending_writes[0]:
pending_writes = pending_writes[1:]
@ -227,7 +226,7 @@ func flush_writer(pipe_w *os.File, tty_write_channel chan<- *write_msg, write_do
}
close(tty_write_channel)
tty_write_channel = nil
timeout = deadline.Sub(time.Now())
timeout = time.Until(deadline)
if timeout <= 0 {
return
}
@ -241,5 +240,4 @@ func flush_writer(pipe_w *os.File, tty_write_channel chan<- *write_msg, write_do
return
}
}
return
}

View File

@ -230,7 +230,7 @@ func (self *hyperlink_state) apply_osc(raw string) {
self.url = parts[2]
}
func (self hyperlink_state) reset() {
func (self *hyperlink_state) reset() {
self.id = ""
self.url = ""
}

View File

@ -25,7 +25,7 @@ var utf8_data []uint8 = []uint8{
const (
UTF8_ACCEPT UTF8State = 0
UTF8_REJECT = 1
UTF8_REJECT UTF8State = 1
)
func DecodeUtf8(state *UTF8State, codep *UTF8State, byte_ byte) UTF8State {