More linter fixes

This commit is contained in:
Kovid Goyal
2023-09-18 20:59:47 +05:30
parent 6bafdedd65
commit 7faf216f9e
3 changed files with 15 additions and 10 deletions

View File

@@ -447,10 +447,10 @@ func (self *handler) draw_theme_demo() {
if intense { if intense {
s = "bright-" + s s = "bright-" + s
} }
if len(c) > trunc { if len(s) > trunc {
c = c[:trunc] s = s[:trunc]
} }
buf.WriteString(self.lp.SprintStyled("fg="+c, c)) buf.WriteString(self.lp.SprintStyled("fg="+s, s))
buf.WriteString(" ") buf.WriteString(" ")
} }
text := strings.TrimSpace(buf.String()) text := strings.TrimSpace(buf.String())

View File

@@ -128,7 +128,9 @@ func decode_sgr_mouse(text string, screen_size ScreenSize) *MouseEvent {
if len(parts[2]) < 1 { if len(parts[2]) < 1 {
return nil return nil
} }
ans.Pixel.Y, err = strconv.Atoi(parts[2]) if ans.Pixel.Y, err = strconv.Atoi(parts[2]); err != nil {
return nil
}
if last_letter == 'm' { if last_letter == 'm' {
ans.Event_type = MOUSE_RELEASE ans.Event_type = MOUSE_RELEASE
} else if cb&MOTION_INDICATOR != 0 { } else if cb&MOTION_INDICATOR != 0 {

View File

@@ -324,8 +324,9 @@ func parse_identify_record(ans *IdentifyRecord, raw *IdentifyOutput) (err error)
if found { if found {
ans.Canvas.Left, err = strconv.Atoi(x) ans.Canvas.Left, err = strconv.Atoi(x)
if err == nil { if err == nil {
ans.Canvas.Top, err = strconv.Atoi(y) if ans.Canvas.Top, err = strconv.Atoi(y); err == nil {
ok = true ok = true
}
} }
} }
} }
@@ -340,8 +341,9 @@ func parse_identify_record(ans *IdentifyRecord, raw *IdentifyOutput) (err error)
if found { if found {
ans.Width, err = strconv.Atoi(w) ans.Width, err = strconv.Atoi(w)
if err == nil { if err == nil {
ans.Height, err = strconv.Atoi(h) if ans.Height, err = strconv.Atoi(h); err == nil {
ok = true ok = true
}
} }
} }
if !ok { if !ok {
@@ -352,8 +354,9 @@ func parse_identify_record(ans *IdentifyRecord, raw *IdentifyOutput) (err error)
if found { if found {
ans.Dpi.X, err = strconv.ParseFloat(x, 64) ans.Dpi.X, err = strconv.ParseFloat(x, 64)
if err == nil { if err == nil {
ans.Dpi.Y, err = strconv.ParseFloat(y, 64) if ans.Dpi.Y, err = strconv.ParseFloat(y, 64); err == nil {
ok = true ok = true
}
} }
} }
if !ok { if !ok {