More linter fixes

This commit is contained in:
Kovid Goyal
2023-09-24 09:06:15 +05:30
parent 70110d54b0
commit 4af1a38507
3 changed files with 8 additions and 7 deletions

View File

@@ -426,10 +426,10 @@ type DefaultColor int
const (
BACKGROUND DefaultColor = 11
FOREGROUND = 10
CURSOR = 12
SELECTION_BG = 17
SELECTION_FG = 19
FOREGROUND DefaultColor = 10
CURSOR DefaultColor = 12
SELECTION_BG DefaultColor = 17
SELECTION_FG DefaultColor = 19
)
func (self *Loop) SetDefaultColor(which DefaultColor, val style.RGBA) {

View File

@@ -13,6 +13,7 @@ import (
)
var debugprintln = tty.DebugPrintln
var _ = debugprintln
type timer struct {
interval time.Duration
@@ -27,7 +28,7 @@ func (self *timer) update_deadline(now time.Time) {
}
func (self timer) String() string {
return fmt.Sprintf("Timer(id=%d, callback=%s, deadline=%s, repeats=%v)", self.id, utils.FunctionName(self.callback), self.deadline.Sub(time.Now()), self.repeats)
return fmt.Sprintf("Timer(id=%d, callback=%s, deadline=%s, repeats=%v)", self.id, utils.FunctionName(self.callback), time.Until(self.deadline), self.repeats)
}
func (self *Loop) add_timer(interval time.Duration, repeats bool, callback TimerCallback) (IdType, error) {

View File

@@ -79,7 +79,7 @@ func (self *Loop) wait_for_write_to_complete(sentinel IdType, tty_write_channel
end_time := time.Now().Add(timeout)
for num_sent < len(self.pending_writes) {
timeout = end_time.Sub(time.Now())
timeout = time.Until(end_time)
if timeout <= 0 {
return os.ErrDeadlineExceeded
}
@@ -104,7 +104,7 @@ func (self *Loop) wait_for_write_to_complete(sentinel IdType, tty_write_channel
}
}
for {
timeout = end_time.Sub(time.Now())
timeout = time.Until(end_time)
if timeout <= 0 {
return os.ErrDeadlineExceeded
}