aboutsummaryrefslogtreecommitdiff
path: root/widgets/aerc.go
diff options
context:
space:
mode:
authorMarkus Ongyerth <aerc@ongy.net>2018-06-01 09:58:00 +0200
committerDrew DeVault <sir@cmpwn.com>2018-06-01 16:04:43 -0700
commit80e891a8024ac10a60daa790131e04f0326b0c73 (patch)
tree7a07cc26b2885e43e57e1672d2895c7fae2b173e /widgets/aerc.go
parent3836d240c9aa26615e7d768a57436d171edc3831 (diff)
switch to tcell from termbox
This is a simple mostly straight forward switch to tcell in favor of termbox. It uses the tcell native api (not the compat layer) but does not make use of most features. Further changes should include moving to tcell's views.TextArea and the general built in widget behaviour instead of the current ad hoc implementation. Regression: Cursor isn't shown in ex-line
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go24
1 files changed, 11 insertions, 13 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 5563275..19ddfdd 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -5,7 +5,7 @@ import (
"log"
"time"
- tb "github.com/nsf/termbox-go"
+ "github.com/gdamore/tcell"
libui "git.sr.ht/~sircmpwn/aerc2/lib/ui"
)
@@ -35,7 +35,7 @@ func NewAerc(logger *log.Logger) *Aerc {
// TODO: move sidebar into tab content, probably
grid.AddChild(libui.NewText("aerc").
Strategy(libui.TEXT_CENTER).
- Color(tb.ColorBlack, tb.ColorWhite))
+ Color(tcell.ColorBlack, tcell.ColorWhite))
// sidebar placeholder:
grid.AddChild(libui.NewBordered(
libui.NewFill('.'), libui.BORDER_RIGHT)).At(1, 0).Span(2, 1)
@@ -75,10 +75,10 @@ func (aerc *Aerc) Draw(ctx *libui.Context) {
aerc.grid.Draw(ctx)
}
-func (aerc *Aerc) Event(event tb.Event) bool {
- switch event.Type {
- case tb.EventKey:
- if event.Ch == ':' {
+func (aerc *Aerc) Event(event tcell.Event) bool {
+ switch event := event.(type) {
+ case *tcell.EventKey:
+ if event.Rune() == ':' {
exline := NewExLine(func(command string) {
aerc.statusline.Push(fmt.Sprintf("TODO: execute %s", command),
3 * time.Second)
@@ -92,12 +92,10 @@ func (aerc *Aerc) Event(event tb.Event) bool {
aerc.statusbar.Push(exline)
return true
}
- fallthrough
- default:
- if aerc.interactive != nil {
- return aerc.interactive.Event(event)
- } else {
- return false
- }
+ }
+ if aerc.interactive != nil {
+ return aerc.interactive.Event(event)
+ } else {
+ return false
}
}