aboutsummaryrefslogtreecommitdiffstats
path: root/termui/termui.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-30 18:09:44 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-30 18:09:44 +0200
commit29bb7364c8e873c72a386f4f6fa26248e5355cb2 (patch)
tree754077feaa733c87ca5b8d17af28644be373beae /termui/termui.go
parentc0dbe70ee08db699a35d573ba09f7900fb959f92 (diff)
downloadgit-bug-29bb7364c8e873c72a386f4f6fa26248e5355cb2.tar.gz
termui: interactive and responsible list of bugs
Diffstat (limited to 'termui/termui.go')
-rw-r--r--termui/termui.go43
1 files changed, 31 insertions, 12 deletions
diff --git a/termui/termui.go b/termui/termui.go
index a8248442..41212d26 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -51,7 +51,7 @@ func layout(g *gocui.Gui) error {
ui.bugTable.layout(g)
- v, err := g.View("table")
+ v, err := g.View("bugTable")
if err != nil {
return err
}
@@ -65,26 +65,35 @@ func keybindings(g *gocui.Gui) error {
if err := g.SetKeybinding("", 'q', gocui.ModNone, quit); err != nil {
return err
}
- if err := g.SetKeybinding("table", 'j', gocui.ModNone, cursorDown); err != nil {
+ if err := g.SetKeybinding("bugTable", 'j', gocui.ModNone, cursorDown); err != nil {
return err
}
- if err := g.SetKeybinding("table", gocui.KeyArrowDown, gocui.ModNone, cursorDown); err != nil {
+ if err := g.SetKeybinding("bugTable", gocui.KeyArrowDown, gocui.ModNone, cursorDown); err != nil {
return err
}
- if err := g.SetKeybinding("table", 'k', gocui.ModNone, cursorUp); err != nil {
+ if err := g.SetKeybinding("bugTable", 'k', gocui.ModNone, cursorUp); err != nil {
return err
}
- if err := g.SetKeybinding("table", gocui.KeyArrowUp, gocui.ModNone, cursorUp); err != nil {
+ if err := g.SetKeybinding("bugTable", gocui.KeyArrowUp, gocui.ModNone, cursorUp); err != nil {
return err
}
- //err = g.SetKeybinding("table", 'h', gocui.ModNone, popTable)
- //err = g.SetKeybinding("table", gocui.KeyArrowLeft, gocui.ModNone, popTable)
- //err = g.SetKeybinding("table", 'l', gocui.ModNone, pushTable)
- //err = g.SetKeybinding("table", gocui.KeyArrowRight, gocui.ModNone, pushTable)
- //err = g.SetKeybinding("table", 'p', gocui.ModNone, playSelected)
- //err = g.SetKeybinding("table", gocui.KeyEnter, gocui.ModNone, playSelectedAndExit)
- //err = g.SetKeybinding("table", 'm', gocui.ModNone, loadNextRecords)
+ if err := g.SetKeybinding("bugTable", 'h', gocui.ModNone, previousPage); err != nil {
+ return err
+ }
+ if err := g.SetKeybinding("bugTable", gocui.KeyArrowLeft, gocui.ModNone, previousPage); err != nil {
+ return err
+ }
+ if err := g.SetKeybinding("bugTable", 'l', gocui.ModNone, nextPage); err != nil {
+ return err
+ }
+ if err := g.SetKeybinding("bugTable", gocui.KeyArrowRight, gocui.ModNone, nextPage); err != nil {
+ return err
+ }
+
+ //err = g.SetKeybinding("bugTable", 'p', gocui.ModNone, playSelected)
+ //err = g.SetKeybinding("bugTable", gocui.KeyEnter, gocui.ModNone, playSelectedAndExit)
+ //err = g.SetKeybinding("bugTable", 'm', gocui.ModNone, loadNextRecords)
return nil
}
@@ -130,3 +139,13 @@ func cursorClamp(v *gocui.View) error {
return nil
}
+
+func nextPage(g *gocui.Gui, v *gocui.View) error {
+ _, maxY := v.Size()
+ return ui.bugTable.nextPage(maxY)
+}
+
+func previousPage(g *gocui.Gui, v *gocui.View) error {
+ _, maxY := v.Size()
+ return ui.bugTable.previousPage(maxY)
+}