diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2021-09-13 14:10:09 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-09-13 14:10:09 +0200 |
commit | 2eaf8b69e82603093b56ace5fdedbdc0249e77a0 (patch) | |
tree | 22ecc819dd52808dae66eb4017618df6877e2de9 /ui | |
parent | Random code improvements/tidying (diff) |
More lints
Diffstat (limited to '')
-rw-r--r-- | ui/editor_test.go | 6 | ||||
-rw-r--r-- | ui/style.go | 2 | ||||
-rw-r--r-- | ui/style_test.go | 20 |
3 files changed, 14 insertions, 14 deletions
diff --git a/ui/editor_test.go b/ui/editor_test.go index d670e0e..733f633 100644 --- a/ui/editor_test.go +++ b/ui/editor_test.go @@ -2,8 +2,8 @@ package ui import "testing" -var hell Editor = Editor{ - text: [][]rune{[]rune{'h', 'e', 'l', 'l'}}, +var hell = Editor{ + text: [][]rune{{'h', 'e', 'l', 'l'}}, textWidth: []int{0, 1, 2, 3, 4}, cursorIdx: 4, offsetIdx: 0, @@ -55,7 +55,7 @@ func TestOneLetter(t *testing.T) { e.Resize(5) e.PutRune('h') assertEditorEq(t, e, Editor{ - text: [][]rune{[]rune{'h'}}, + text: [][]rune{{'h'}}, textWidth: []int{0, 1}, cursorIdx: 1, offsetIdx: 0, diff --git a/ui/style.go b/ui/style.go index f596ac0..76ca3f0 100644 --- a/ui/style.go +++ b/ui/style.go @@ -10,7 +10,7 @@ import ( "github.com/mattn/go-runewidth" ) -var condition runewidth.Condition = runewidth.Condition{} +var condition = runewidth.Condition{} func runeWidth(r rune) int { return condition.RuneWidth(r) diff --git a/ui/style_test.go b/ui/style_test.go index 4ba2e9d..d6846a7 100644 --- a/ui/style_test.go +++ b/ui/style_test.go @@ -35,62 +35,62 @@ func TestIRCString(t *testing.T) { assertIRCString(t, "\x02hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Bold(true)}, + {Start: 0, Style: tcell.StyleDefault.Bold(true)}, }, }) assertIRCString(t, "\x035hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, }, }) assertIRCString(t, "\x0305hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, }, }) assertIRCString(t, "\x0305,0hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, }, }) assertIRCString(t, "\x035,00hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, }, }) assertIRCString(t, "\x0305,00hello", StyledString{ string: "hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, }, }) assertIRCString(t, "\x035,hello", StyledString{ string: ",hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, }, }) assertIRCString(t, "\x0305,hello", StyledString{ string: ",hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, }, }) assertIRCString(t, "\x03050hello", StyledString{ string: "0hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown)}, }, }) assertIRCString(t, "\x0305,000hello", StyledString{ string: "0hello", styles: []rangedStyle{ - rangedStyle{Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, + {Start: 0, Style: tcell.StyleDefault.Foreground(tcell.ColorBrown).Background(tcell.ColorWhite)}, }, }) } |