diff --git a/button.go b/button.go index d0a56f9..8d02985 100644 --- a/button.go +++ b/button.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/objects/layouts" diff --git a/checkbox.go b/checkbox.go index e25ed2a..f24de62 100644 --- a/checkbox.go +++ b/checkbox.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" diff --git a/container.go b/container.go index aea3a9b..4629b6c 100644 --- a/container.go +++ b/container.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" // Container is an object that can contain other objects. It can be used as a // primitive for building more complex layouts. It has two variants: an outer diff --git a/dialog.go b/dialog.go index e40c011..e26eda8 100644 --- a/dialog.go +++ b/dialog.go @@ -3,7 +3,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo/event" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/objects/layouts" // DialogKind defines the semantic role of a dialog window. diff --git a/go.mod b/go.mod index 31d8992..f6a91c9 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,6 @@ module git.tebibyte.media/tomo/objects go 1.20 -require git.tebibyte.media/tomo/tomo v0.31.0 +require git.tebibyte.media/tomo/tomo v0.33.0 require golang.org/x/image v0.11.0 // indirect diff --git a/go.sum b/go.sum index 3202ae4..8f419ab 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.tebibyte.media/tomo/tomo v0.31.0 h1:LHPpj3AWycochnC8F441aaRNS6Tq6w6WnBrp/LGjyhM= -git.tebibyte.media/tomo/tomo v0.31.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps= +git.tebibyte.media/tomo/tomo v0.33.0 h1:BBm1oRsogBLeqVKeevNqG9RPCOdmbGeiQM/9hd2GHE8= +git.tebibyte.media/tomo/tomo v0.33.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= diff --git a/heading.go b/heading.go index 9775a64..7b88ae9 100644 --- a/heading.go +++ b/heading.go @@ -2,7 +2,6 @@ package objects import "fmt" import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" // Heading is a label that denotes the start of some section of content. It can // have a level from 0 to 2, with 0 being the most prominent and 2 being the diff --git a/icon.go b/icon.go index 277d44f..d22cd05 100644 --- a/icon.go +++ b/icon.go @@ -3,7 +3,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo/data" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/canvas" // Icon displays a single icon. diff --git a/label.go b/label.go index 0108a30..619989d 100644 --- a/label.go +++ b/label.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" // Label is a simple text label. type Label struct { diff --git a/labelcheckbox.go b/labelcheckbox.go index 3f0b5e4..e2c8981 100644 --- a/labelcheckbox.go +++ b/labelcheckbox.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/objects/layouts" diff --git a/numberinput.go b/numberinput.go index 68b5aba..c9661c5 100644 --- a/numberinput.go +++ b/numberinput.go @@ -3,7 +3,6 @@ package objects import "math" import "strconv" import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/objects/layouts" diff --git a/scrollbar.go b/scrollbar.go index 4b45ced..c0d1379 100644 --- a/scrollbar.go +++ b/scrollbar.go @@ -2,7 +2,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" diff --git a/scrollcontainer.go b/scrollcontainer.go index b51b498..d32c093 100644 --- a/scrollcontainer.go +++ b/scrollcontainer.go @@ -3,7 +3,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo/event" -import "git.tebibyte.media/tomo/tomo/theme" // ScrollSide determines which Scrollbars are active in a ScrollContainer. type ScrollSide int; const ( diff --git a/separator.go b/separator.go index af9d0ff..33c613a 100644 --- a/separator.go +++ b/separator.go @@ -1,7 +1,6 @@ package objects import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" // Separator is a line for visually separating elements. type Separator struct { diff --git a/slider.go b/slider.go index 9b2cac9..ff276c4 100644 --- a/slider.go +++ b/slider.go @@ -2,7 +2,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" diff --git a/textinput.go b/textinput.go index dd0a5f9..fd76fee 100644 --- a/textinput.go +++ b/textinput.go @@ -3,7 +3,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo/text" -import "git.tebibyte.media/tomo/tomo/theme" import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/event" @@ -60,8 +59,8 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) { sel := modifiers.Shift changed := false - // TODO all this (except editing stuff) really should be moved into the - // backend + // TODO all dot control (movement, selection, etc) should be done in the + // backend. (editing should be done here, though) switch { case key == input.KeyEnter: @@ -105,6 +104,14 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) { } } +// Type types a character at the current dot position. +func (this *TextInput) Type (char rune) { + dot := this.Dot() + this.text, dot = text.Type(this.text, dot, rune(char)) + this.Select(dot) + this.SetText(string(this.text)) +} + func (this *TextInput) handleScroll (x, y float64) { this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y)))) } diff --git a/textview.go b/textview.go index 846deb2..42f4e67 100644 --- a/textview.go +++ b/textview.go @@ -2,7 +2,6 @@ package objects import "image" import "git.tebibyte.media/tomo/tomo" -import "git.tebibyte.media/tomo/tomo/theme" // TextView is an area for displaying a large amount of multi-line text. type TextView struct {