aboutsummaryrefslogtreecommitdiffstats
path: root/termui/termui.go
diff options
context:
space:
mode:
Diffstat (limited to 'termui/termui.go')
-rw-r--r--termui/termui.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/termui/termui.go b/termui/termui.go
index f4a4fb26..727b9f3d 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -11,20 +11,33 @@ import (
var errTerminateMainloop = errors.New("terminate gocui mainloop")
type termUI struct {
- g *gocui.Gui
- gError chan error
- cache cache.RepoCacher
+ g *gocui.Gui
+ gError chan error
+ cache cache.RepoCacher
+
activeWindow window
bugTable *bugTable
+ showBug *showBug
errorPopup *errorPopup
}
+func (tui *termUI) activateWindow(window window) error {
+ if err := tui.activeWindow.disable(tui.g); err != nil {
+ return err
+ }
+
+ tui.activeWindow = window
+
+ return nil
+}
+
var ui *termUI
type window interface {
keybindings(g *gocui.Gui) error
layout(g *gocui.Gui) error
+ disable(g *gocui.Gui) error
}
func Run(repo repository.Repo) error {
@@ -34,6 +47,7 @@ func Run(repo repository.Repo) error {
gError: make(chan error, 1),
cache: c,
bugTable: newBugTable(c),
+ showBug: newShowBug(c),
errorPopup: newErrorPopup(),
}
@@ -107,6 +121,10 @@ func keybindings(g *gocui.Gui) error {
return err
}
+ if err := ui.showBug.keybindings(g); err != nil {
+ return err
+ }
+
if err := ui.errorPopup.keybindings(g); err != nil {
return err
}