aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/context.go8
-rw-r--r--lib/ui/stack.go4
-rw-r--r--lib/ui/text.go2
3 files changed, 7 insertions, 7 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 (