diff options
-rw-r--r-- | app/account-wizard.go | 3 | ||||
-rw-r--r-- | app/account.go | 5 | ||||
-rw-r--r-- | app/aerc.go | 3 | ||||
-rw-r--r-- | app/compose.go | 11 | ||||
-rw-r--r-- | app/dirlist.go | 3 | ||||
-rw-r--r-- | app/dirtree.go | 3 | ||||
-rw-r--r-- | app/exline.go | 3 | ||||
-rw-r--r-- | app/getpasswd.go | 3 | ||||
-rw-r--r-- | app/listbox.go | 3 | ||||
-rw-r--r-- | app/msglist.go | 3 | ||||
-rw-r--r-- | app/msgviewer.go | 7 | ||||
-rw-r--r-- | app/partswitcher.go | 5 | ||||
-rw-r--r-- | app/selector.go | 5 | ||||
-rw-r--r-- | app/terminal.go | 7 | ||||
-rw-r--r-- | commands/patch/list.go | 4 | ||||
-rw-r--r-- | commands/util.go | 4 | ||||
-rw-r--r-- | lib/ui/borders.go | 5 | ||||
-rw-r--r-- | lib/ui/box.go | 6 | ||||
-rw-r--r-- | lib/ui/grid.go | 3 | ||||
-rw-r--r-- | lib/ui/interfaces.go | 6 | ||||
-rw-r--r-- | lib/ui/popover.go | 4 | ||||
-rw-r--r-- | lib/ui/tab.go | 3 | ||||
-rw-r--r-- | lib/ui/textinput.go | 5 | ||||
-rw-r--r-- | lib/ui/ui.go | 2 |
24 files changed, 59 insertions, 47 deletions
diff --git a/app/account-wizard.go b/app/account-wizard.go index 9ee69627..e47acc53 100644 --- a/app/account-wizard.go +++ b/app/account-wizard.go @@ -22,6 +22,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/lib/xdg" "git.sr.ht/~rjarry/aerc/log" + "git.sr.ht/~rockorager/vaxis" ) const ( @@ -747,7 +748,7 @@ func (wizard *AccountWizard) Focus(focus bool) { } } -func (wizard *AccountWizard) Event(event tcell.Event) bool { +func (wizard *AccountWizard) Event(event vaxis.Event) bool { interactive := wizard.getInteractive() if event, ok := event.(*tcell.EventKey); ok { switch event.Key() { diff --git a/app/account.go b/app/account.go index 5b540523..4b5fa30b 100644 --- a/app/account.go +++ b/app/account.go @@ -7,8 +7,6 @@ import ( "sync" "time" - "github.com/gdamore/tcell/v2" - "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/hooks" @@ -21,6 +19,7 @@ import ( "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rockorager/vaxis" ) var _ ProvidesMessages = (*AccountView)(nil) @@ -168,7 +167,7 @@ func (acct *AccountView) Draw(ctx *ui.Context) { acct.grid.Draw(ctx) } -func (acct *AccountView) MouseEvent(localX int, localY int, event tcell.Event) { +func (acct *AccountView) MouseEvent(localX int, localY int, event vaxis.Event) { acct.grid.MouseEvent(localX, localY, event) } diff --git a/app/aerc.go b/app/aerc.go index 261e1af7..f4ad531a 100644 --- a/app/aerc.go +++ b/app/aerc.go @@ -11,6 +11,7 @@ import ( "time" "git.sr.ht/~rjarry/go-opt" + "git.sr.ht/~rockorager/vaxis" "github.com/ProtonMail/go-crypto/openpgp" "github.com/emersion/go-message/mail" "github.com/gdamore/tcell/v2" @@ -308,7 +309,7 @@ func (aerc *Aerc) simulate(strokes []config.KeyStroke) { } } -func (aerc *Aerc) Event(event tcell.Event) bool { +func (aerc *Aerc) Event(event vaxis.Event) bool { if aerc.dialog != nil { return aerc.dialog.Event(event) } diff --git a/app/compose.go b/app/compose.go index d7a0b1c8..7bc3fd66 100644 --- a/app/compose.go +++ b/app/compose.go @@ -31,6 +31,7 @@ import ( "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rockorager/vaxis" ) type Composer struct { @@ -751,7 +752,7 @@ func (c *Composer) focusActiveWidget(focus bool) { } } -func (c *Composer) Event(event tcell.Event) bool { +func (c *Composer) Event(event vaxis.Event) bool { c.Lock() defer c.Unlock() if w := c.focusedWidget(); c.editor != nil && w != nil { @@ -760,7 +761,7 @@ func (c *Composer) Event(event tcell.Event) bool { return false } -func (c *Composer) MouseEvent(localX int, localY int, event tcell.Event) { +func (c *Composer) MouseEvent(localX int, localY int, event vaxis.Event) { c.Lock() for _, e := range c.focusable { he, ok := e.(*headerEditor) @@ -1147,7 +1148,7 @@ func (c *Composer) resetReview() { } } -func (c *Composer) termEvent(event tcell.Event) bool { +func (c *Composer) termEvent(event vaxis.Event) bool { if event, ok := event.(*tcell.EventMouse); ok { if event.Buttons() == tcell.Button1 { c.FocusTerminal() @@ -1566,7 +1567,7 @@ func (he *headerEditor) Draw(ctx *ui.Context) { he.input.Draw(ctx.Subcontext(size, 0, ctx.Width()-size, 1)) } -func (he *headerEditor) MouseEvent(localX int, localY int, event tcell.Event) { +func (he *headerEditor) MouseEvent(localX int, localY int, event vaxis.Event) { if event, ok := event.(*tcell.EventMouse); ok { if event.Buttons() == tcell.Button1 { he.focused = true @@ -1588,7 +1589,7 @@ func (he *headerEditor) Focus(focused bool) { he.input.Focus(focused) } -func (he *headerEditor) Event(event tcell.Event) bool { +func (he *headerEditor) Event(event vaxis.Event) bool { return he.input.Event(event) } diff --git a/app/dirlist.go b/app/dirlist.go index d260d7c1..53aeed9d 100644 --- a/app/dirlist.go +++ b/app/dirlist.go @@ -19,6 +19,7 @@ import ( "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rockorager/vaxis" ) type DirectoryLister interface { @@ -374,7 +375,7 @@ func (dirlist *DirectoryList) drawScrollbar(ctx *ui.Context) { ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle) } -func (dirlist *DirectoryList) MouseEvent(localX int, localY int, event tcell.Event) { +func (dirlist *DirectoryList) MouseEvent(localX int, localY int, event vaxis.Event) { if event, ok := event.(*tcell.EventMouse); ok { switch event.Buttons() { case tcell.Button1: diff --git a/app/dirtree.go b/app/dirtree.go index ce9bd27e..30ef2480 100644 --- a/app/dirtree.go +++ b/app/dirtree.go @@ -14,6 +14,7 @@ import ( "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rockorager/vaxis" "github.com/gdamore/tcell/v2" ) @@ -166,7 +167,7 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) { } } -func (dt *DirectoryTree) MouseEvent(localX int, localY int, event tcell.Event) { +func (dt *DirectoryTree) MouseEvent(localX int, localY int, event vaxis.Event) { if event, ok := event.(*tcell.EventMouse); ok { switch event.Buttons() { case tcell.Button1: diff --git a/app/exline.go b/app/exline.go index 61fc340a..7eb6fde3 100644 --- a/app/exline.go +++ b/app/exline.go @@ -6,6 +6,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rockorager/vaxis" ) type ExLine struct { @@ -81,7 +82,7 @@ func (ex *ExLine) Focus(focus bool) { ex.input.Focus(focus) } -func (ex *ExLine) Event(event tcell.Event) bool { +func (ex *ExLine) Event(event vaxis.Event) bool { if event, ok := event.(*tcell.EventKey); ok { switch event.Key() { case tcell.KeyEnter, tcell.KeyCtrlJ: diff --git a/app/getpasswd.go b/app/getpasswd.go index 9a3dbf3b..8781bce7 100644 --- a/app/getpasswd.go +++ b/app/getpasswd.go @@ -7,6 +7,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rockorager/vaxis" ) type GetPasswd struct { @@ -44,7 +45,7 @@ func (gp *GetPasswd) Invalidate() { ui.Invalidate() } -func (gp *GetPasswd) Event(event tcell.Event) bool { +func (gp *GetPasswd) Event(event vaxis.Event) bool { switch event := event.(type) { case *tcell.EventKey: switch event.Key() { diff --git a/app/listbox.go b/app/listbox.go index 7d1a4f27..d22eea1b 100644 --- a/app/listbox.go +++ b/app/listbox.go @@ -9,6 +9,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/log" + "git.sr.ht/~rockorager/vaxis" "github.com/gdamore/tcell/v2" "github.com/mattn/go-runewidth" ) @@ -228,7 +229,7 @@ func (lb *ListBox) Invalidate() { ui.Invalidate() } -func (lb *ListBox) Event(event tcell.Event) bool { +func (lb *ListBox) Event(event vaxis.Event) bool { showFilter := lb.showFilterField() if event, ok := event.(*tcell.EventKey); ok { switch event.Key() { diff --git a/app/msglist.go b/app/msglist.go index 38970123..49529811 100644 --- a/app/msglist.go +++ b/app/msglist.go @@ -17,6 +17,7 @@ import ( "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" + "git.sr.ht/~rockorager/vaxis" ) type MessageList struct { @@ -270,7 +271,7 @@ func (ml *MessageList) drawScrollbar(ctx *ui.Context) { ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle) } -func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) { +func (ml *MessageList) MouseEvent(localX int, localY int, event vaxis.Event) { if event, ok := event.(*tcell.EventMouse); ok { switch event.Buttons() { case tcell.Button1: diff --git a/app/msgviewer.go b/app/msgviewer.go index 8d2e380a..a22d2c15 100644 --- a/app/msgviewer.go +++ b/app/msgviewer.go @@ -13,7 +13,6 @@ import ( "github.com/danwakefield/fnmatch" "github.com/emersion/go-message/textproto" - "github.com/gdamore/tcell/v2" "github.com/mattn/go-runewidth" "git.sr.ht/~rjarry/aerc/config" @@ -286,7 +285,7 @@ func (mv *MessageViewer) Draw(ctx *ui.Context) { mv.grid.Draw(ctx) } -func (mv *MessageViewer) MouseEvent(localX int, localY int, event tcell.Event) { +func (mv *MessageViewer) MouseEvent(localX int, localY int, event vaxis.Event) { if mv.err != nil { return } @@ -398,7 +397,7 @@ func (mv *MessageViewer) Close() { } } -func (mv *MessageViewer) Event(event tcell.Event) bool { +func (mv *MessageViewer) Event(event vaxis.Event) bool { return mv.switcher.Event(event) } @@ -824,7 +823,7 @@ func (pv *PartViewer) resized(ctx *ui.Context) bool { return false } -func (pv *PartViewer) Event(event tcell.Event) bool { +func (pv *PartViewer) Event(event vaxis.Event) bool { if pv.term != nil { return pv.term.Event(event) } diff --git a/app/partswitcher.go b/app/partswitcher.go index 3f070c44..8552d32b 100644 --- a/app/partswitcher.go +++ b/app/partswitcher.go @@ -5,6 +5,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rockorager/vaxis" "github.com/gdamore/tcell/v2" "github.com/mattn/go-runewidth" ) @@ -79,7 +80,7 @@ func (ps *PartSwitcher) Show(visible bool) { } } -func (ps *PartSwitcher) Event(event tcell.Event) bool { +func (ps *PartSwitcher) Event(event vaxis.Event) bool { return ps.parts[ps.selected].Event(event) } @@ -161,7 +162,7 @@ func (ps *PartSwitcher) drawScrollbar(ctx *ui.Context) { ctx.Fill(0, pillOffset, 1, pillSize, ' ', pillStyle) } -func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) { +func (ps *PartSwitcher) MouseEvent(localX int, localY int, event vaxis.Event) { if localY < ps.offset && ps.parts[ps.selected].term != nil { ps.parts[ps.selected].term.MouseEvent(localX, localY, event) return diff --git a/app/selector.go b/app/selector.go index 7f4730d0..fe8c4d96 100644 --- a/app/selector.go +++ b/app/selector.go @@ -9,6 +9,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib/ui" + "git.sr.ht/~rockorager/vaxis" ) type Selector struct { @@ -143,7 +144,7 @@ func (sel *Selector) Focus(focus bool) { sel.Invalidate() } -func (sel *Selector) Event(event tcell.Event) bool { +func (sel *Selector) Event(event vaxis.Event) bool { if event, ok := event.(*tcell.EventKey); ok { switch event.Key() { case tcell.KeyCtrlH: @@ -239,7 +240,7 @@ func (gp *SelectorDialog) Invalidate() { ui.Invalidate() } -func (gp *SelectorDialog) Event(event tcell.Event) bool { +func (gp *SelectorDialog) Event(event vaxis.Event) bool { switch event := event.(type) { case *tcell.EventKey: switch event.Key() { diff --git a/app/terminal.go b/app/terminal.go index f0335de3..c99af26a 100644 --- a/app/terminal.go +++ b/app/terminal.go @@ -8,6 +8,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/log" tcellterm "git.sr.ht/~rockorager/tcell-term" + "git.sr.ht/~rockorager/vaxis" "github.com/gdamore/tcell/v2" ) @@ -26,7 +27,7 @@ type Terminal struct { running bool OnClose func(err error) - OnEvent func(event tcell.Event) bool + OnEvent func(event vaxis.Event) bool OnStart func() OnTitle func(title string) } @@ -124,7 +125,7 @@ func (term *Terminal) Terminal() *Terminal { return term } -func (term *Terminal) MouseEvent(localX int, localY int, event tcell.Event) { +func (term *Terminal) MouseEvent(localX int, localY int, event vaxis.Event) { ev, ok := event.(*tcell.EventMouse) if !ok { return @@ -176,7 +177,7 @@ func (term *Terminal) HandleEvent(ev tcell.Event) { } } -func (term *Terminal) Event(event tcell.Event) bool { +func (term *Terminal) Event(event vaxis.Event) bool { if term.OnEvent != nil { if term.OnEvent(event) { return true diff --git a/commands/patch/list.go b/commands/patch/list.go index ee2850c3..e73cea3a 100644 --- a/commands/patch/list.go +++ b/commands/patch/list.go @@ -14,7 +14,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib/pama/models" "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/go-opt" - "github.com/gdamore/tcell/v2" + "git.sr.ht/~rockorager/vaxis" ) type List struct { @@ -70,7 +70,7 @@ func (l List) Execute(args []string) error { app.CloseDialog() return } - term.OnEvent = func(_ tcell.Event) bool { + term.OnEvent = func(_ vaxis.Event) bool { app.CloseDialog() return true } diff --git a/commands/util.go b/commands/util.go index af8d3dfa..0f6c7cb6 100644 --- a/commands/util.go +++ b/commands/util.go @@ -19,7 +19,7 @@ import ( "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" "git.sr.ht/~rjarry/go-opt" - "github.com/gdamore/tcell/v2" + "git.sr.ht/~rockorager/vaxis" ) // QuickTerm is an ephemeral terminal for running a single command and quitting. @@ -43,7 +43,7 @@ func QuickTerm(args []string, stdin io.Reader) (*app.Terminal, error) { } else { app.PushStatus("Process complete, press any key to close.", 10*time.Second) - term.OnEvent = func(event tcell.Event) bool { + term.OnEvent = func(event vaxis.Event) bool { app.RemoveTab(term, true) return true } diff --git a/lib/ui/borders.go b/lib/ui/borders.go index 81d5db61..fb3db6b1 100644 --- a/lib/ui/borders.go +++ b/lib/ui/borders.go @@ -1,9 +1,8 @@ package ui import ( - "github.com/gdamore/tcell/v2" - "git.sr.ht/~rjarry/aerc/config" + "git.sr.ht/~rockorager/vaxis" ) const ( @@ -69,7 +68,7 @@ func (bordered *Bordered) Draw(ctx *Context) { bordered.content.Draw(subctx) } -func (bordered *Bordered) MouseEvent(localX int, localY int, event tcell.Event) { +func (bordered *Bordered) MouseEvent(localX int, localY int, event vaxis.Event) { if content, ok := bordered.content.(Mouseable); ok { content.MouseEvent(localX, localY, event) } diff --git a/lib/ui/box.go b/lib/ui/box.go index e13b70f3..fc833b72 100644 --- a/lib/ui/box.go +++ b/lib/ui/box.go @@ -4,7 +4,7 @@ import ( "strings" "git.sr.ht/~rjarry/aerc/config" - "github.com/gdamore/tcell/v2" + "git.sr.ht/~rockorager/vaxis" "github.com/mattn/go-runewidth" ) @@ -58,13 +58,13 @@ func (b *Box) Invalidate() { b.content.Invalidate() } -func (b *Box) MouseEvent(localX int, localY int, event tcell.Event) { +func (b *Box) MouseEvent(localX int, localY int, event vaxis.Event) { if content, ok := b.content.(Mouseable); ok { content.MouseEvent(localX, localY, event) } } -func (b *Box) Event(e tcell.Event) bool { +func (b *Box) Event(e vaxis.Event) bool { if content, ok := b.content.(Interactive); ok { return content.Event(e) } diff --git a/lib/ui/grid.go b/lib/ui/grid.go index 28640d03..00f759bf 100644 --- a/lib/ui/grid.go +++ b/lib/ui/grid.go @@ -4,6 +4,7 @@ import ( "math" "sync" + "git.sr.ht/~rockorager/vaxis" "github.com/gdamore/tcell/v2" ) @@ -128,7 +129,7 @@ func (grid *Grid) Draw(ctx *Context) { } } -func (grid *Grid) MouseEvent(localX int, localY int, event tcell.Event) { +func (grid *Grid) MouseEvent(localX int, localY int, event vaxis.Event) { if event, ok := event.(*tcell.EventMouse); ok { grid.mutex.RLock() diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go index a8520ff5..8ed727cc 100644 --- a/lib/ui/interfaces.go +++ b/lib/ui/interfaces.go @@ -1,7 +1,7 @@ package ui import ( - "github.com/gdamore/tcell/v2" + "git.sr.ht/~rockorager/vaxis" ) // Drawable is a UI component that can draw. Unless specified, all methods must @@ -24,7 +24,7 @@ type Visible interface { type Interactive interface { // Returns true if the event was handled by this component - Event(event tcell.Event) bool + Event(event vaxis.Event) bool // Indicates whether or not this control will receive input events Focus(focus bool) } @@ -53,7 +53,7 @@ type Container interface { type MouseHandler interface { // Handle a mouse event which occurred at the local x and y positions - MouseEvent(localX int, localY int, event tcell.Event) + MouseEvent(localX int, localY int, event vaxis.Event) } // A drawable that can be interacted with by the mouse diff --git a/lib/ui/popover.go b/lib/ui/popover.go index 9cc491da..5a6d0542 100644 --- a/lib/ui/popover.go +++ b/lib/ui/popover.go @@ -1,6 +1,6 @@ package ui -import "github.com/gdamore/tcell/v2" +import "git.sr.ht/~rockorager/vaxis" type Popover struct { x, y, width, height int @@ -39,7 +39,7 @@ func (p *Popover) Draw(ctx *Context) { p.content.Draw(subcontext) } -func (p *Popover) Event(e tcell.Event) bool { +func (p *Popover) Event(e vaxis.Event) bool { if di, ok := p.content.(DrawableInteractive); ok { return di.Event(e) } diff --git a/lib/ui/tab.go b/lib/ui/tab.go index f5e89064..704b01db 100644 --- a/lib/ui/tab.go +++ b/lib/ui/tab.go @@ -7,6 +7,7 @@ import ( "github.com/mattn/go-runewidth" "git.sr.ht/~rjarry/aerc/config" + "git.sr.ht/~rockorager/vaxis" ) const tabRuneWidth int = 32 // TODO: make configurable @@ -494,7 +495,7 @@ func (content *TabContent) Draw(ctx *Context) { tab.Content.Draw(ctx) } -func (content *TabContent) MouseEvent(localX int, localY int, event tcell.Event) { +func (content *TabContent) MouseEvent(localX int, localY int, event vaxis.Event) { content.parent.m.Lock() tab := content.tabs[content.curIndex] content.parent.m.Unlock() diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go index 32a177e1..0bdcd435 100644 --- a/lib/ui/textinput.go +++ b/lib/ui/textinput.go @@ -11,6 +11,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/log" + "git.sr.ht/~rockorager/vaxis" ) // TODO: Attach history providers @@ -332,7 +333,7 @@ func (ti *TextInput) OnFocusLost(onFocusLost func(ti *TextInput)) { ti.focusLost = append(ti.focusLost, onFocusLost) } -func (ti *TextInput) Event(event tcell.Event) bool { +func (ti *TextInput) Event(event vaxis.Event) bool { ti.Lock() defer ti.Unlock() if event, ok := event.(*tcell.EventKey); ok { @@ -480,7 +481,7 @@ func (c *completions) exec() { Invalidate() } -func (c *completions) Event(e tcell.Event) bool { +func (c *completions) Event(e vaxis.Event) bool { if e, ok := e.(*tcell.EventKey); ok { k := c.ti.completeKey if k != nil && k.Key == e.Key() && k.Modifiers == e.Modifiers() { diff --git a/lib/ui/ui.go b/lib/ui/ui.go index b8030949..e13f4f5c 100644 --- a/lib/ui/ui.go +++ b/lib/ui/ui.go @@ -139,7 +139,7 @@ func EnableMouse() { state.screen.EnableMouse() } -func HandleEvent(event tcell.Event) { +func HandleEvent(event vaxis.Event) { if event, ok := event.(*tcell.EventResize); ok { state.screen.Clear() width, height := event.Size() |