aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ui/context.go8
-rw-r--r--lib/ui/stack.go4
-rw-r--r--lib/ui/text.go2
-rw-r--r--widgets/aerc.go10
-rw-r--r--widgets/exline.go6
-rw-r--r--widgets/status.go4
6 files changed, 17 insertions, 17 deletions
diff --git a/lib/ui/context.go b/lib/ui/context.go
index 1665819..d7796bf 100644
--- a/lib/ui/context.go
+++ b/lib/ui/context.go
@@ -3,9 +3,9 @@ package ui
import (
"fmt"
- "github.com/mattn/go-runewidth"
"github.com/gdamore/tcell"
"github.com/gdamore/tcell/views"
+ "github.com/mattn/go-runewidth"
)
// A context allows you to draw in a sub-region of the terminal
@@ -40,10 +40,10 @@ func NewContext(width, height int, screen tcell.Screen) *Context {
func (ctx *Context) Subcontext(x, y, width, height int) *Context {
vp_width, vp_height := ctx.viewport.Size()
- if (x < 0 || y < 0) {
+ if x < 0 || y < 0 {
panic(fmt.Errorf("Attempted to create context with negative offset"))
}
- if (x + width > vp_width || y + height > vp_height) {
+ if x+width > vp_width || y+height > vp_height {
panic(fmt.Errorf("Attempted to create context larger than parent"))
}
vp := views.NewViewPort(ctx.viewport, x, y, width, height)
@@ -88,7 +88,7 @@ func (ctx *Context) Printf(x, y int, style tcell.Style,
crunes := []rune{}
ctx.viewport.SetContent(x, y, ch, crunes, style)
x += runewidth.RuneWidth(ch)
- if x == old_x + width {
+ if x == old_x+width {
if !newline() {
return runewidth.StringWidth(str)
}
diff --git a/lib/ui/stack.go b/lib/ui/stack.go
index 2b97e78..2e3f0b9 100644
--- a/lib/ui/stack.go
+++ b/lib/ui/stack.go
@@ -7,7 +7,7 @@ import (
)
type Stack struct {
- children []Drawable
+ children []Drawable
onInvalidate []func(d Drawable)
}
@@ -15,7 +15,7 @@ func NewStack() *Stack {
return &Stack{}
}
-func (stack *Stack) OnInvalidate(onInvalidate func (d Drawable)) {
+func (stack *Stack) OnInvalidate(onInvalidate func(d Drawable)) {
stack.onInvalidate = append(stack.onInvalidate, onInvalidate)
}
diff --git a/lib/ui/text.go b/lib/ui/text.go
index e2e218c..d3f6c6b 100644
--- a/lib/ui/text.go
+++ b/lib/ui/text.go
@@ -1,8 +1,8 @@
package ui
import (
- "github.com/mattn/go-runewidth"
"github.com/gdamore/tcell"
+ "github.com/mattn/go-runewidth"
)
const (
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 798a4dd..cc93d92 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -69,10 +69,10 @@ func NewAerc(logger *log.Logger) *Aerc {
})()
return &Aerc{
- grid: mainGrid,
- statusbar: statusbar,
- statusline: statusline,
- tabs: tabs,
+ grid: mainGrid,
+ statusbar: statusbar,
+ statusline: statusline,
+ tabs: tabs,
}
}
@@ -94,7 +94,7 @@ func (aerc *Aerc) Event(event tcell.Event) bool {
if event.Rune() == ':' {
exline := NewExLine(func(command string) {
aerc.statusline.Push(fmt.Sprintf("TODO: execute %s", command),
- 3 * time.Second)
+ 3*time.Second)
aerc.statusbar.Pop()
aerc.interactive = nil
}, func() {
diff --git a/widgets/exline.go b/widgets/exline.go
index de652ba..ae83933 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -1,8 +1,8 @@
package widgets
import (
- "github.com/mattn/go-runewidth"
"github.com/gdamore/tcell"
+ "github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc2/lib/ui"
)
@@ -21,7 +21,7 @@ type ExLine struct {
onInvalidate func(d ui.Drawable)
}
-func NewExLine(commit func (cmd string), cancel func()) *ExLine {
+func NewExLine(commit func(cmd string), cancel func()) *ExLine {
return &ExLine{
cancel: cancel,
commit: commit,
@@ -43,7 +43,7 @@ func (ex *ExLine) Draw(ctx *ui.Context) {
ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
ctx.Printf(0, 0, tcell.StyleDefault, ":%s", string(ex.command))
cells := runewidth.StringWidth(string(ex.command[:ex.index]))
- ctx.SetCursor(cells + 1, 0)
+ ctx.SetCursor(cells+1, 0)
}
func (ex *ExLine) insert(ch rune) {
diff --git a/widgets/status.go b/widgets/status.go
index 3b4dbcc..b7d9490 100644
--- a/widgets/status.go
+++ b/widgets/status.go
@@ -31,7 +31,7 @@ func NewStatusLine() *StatusLine {
}
}
-func (status *StatusLine) OnInvalidate(onInvalidate func (d ui.Drawable)) {
+func (status *StatusLine) OnInvalidate(onInvalidate func(d ui.Drawable)) {
status.onInvalidate = onInvalidate
}
@@ -68,7 +68,7 @@ func (status *StatusLine) Push(text string, expiry time.Duration) *StatusMessage
message: text,
}
status.stack = append(status.stack, msg)
- go (func () {
+ go (func() {
time.Sleep(expiry)
for i, m := range status.stack {
if m == msg {