aboutsummaryrefslogtreecommitdiffstats
path: root/termui/termui.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-01 02:15:40 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-01 02:17:06 +0200
commitc875d40e631f83507b602807480be96dae05fc85 (patch)
treea81b0909eda009acb395d936d1e2bf09e03cff3a /termui/termui.go
parent2f88c28c59ce0480e64dfba6d820dc6f7589a6cf (diff)
downloadgit-bug-c875d40e631f83507b602807480be96dae05fc85.tar.gz
termui: add a view to display a bug
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
}