diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-11 17:45:59 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-11 17:46:47 +0200 |
commit | 30e38aab0849d28eaea11c5e1f9f9423a0999e0d (patch) | |
tree | 6ac96fef54bffaa6c11b6db630f1b7af0dce03ff /termui | |
parent | d1c5015eed4cfc8db19b17bd4a67e2c12b6cd8ff (diff) | |
download | git-bug-30e38aab0849d28eaea11c5e1f9f9423a0999e0d.tar.gz |
termui: use Esc key to quit instead of 'q' to free it for a "query" feature
Diffstat (limited to 'termui')
-rw-r--r-- | termui/bug_table.go | 4 | ||||
-rw-r--r-- | termui/show_bug.go | 4 | ||||
-rw-r--r-- | termui/termui.go | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go index 8b50f07b..6ee44b42 100644 --- a/termui/bug_table.go +++ b/termui/bug_table.go @@ -114,7 +114,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v.Frame = false v.BgColor = gocui.ColorBlue - fmt.Fprintf(v, "[q] Quit [←↓↑→,hjkl] Navigation [enter] Open bug [n] New bug [i] Pull [o] Push") + fmt.Fprintf(v, "[Esc] Quit [←↓↑→,hjkl] Navigation [enter] Open bug [n] New bug [i] Pull [o] Push") } _, err = g.SetCurrentView(bugTableView) @@ -123,7 +123,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { func (bt *bugTable) keybindings(g *gocui.Gui) error { // Quit - if err := g.SetKeybinding(bugTableView, 'q', gocui.ModNone, quit); err != nil { + if err := g.SetKeybinding(bugTableView, gocui.KeyEsc, gocui.ModNone, quit); err != nil { return err } diff --git a/termui/show_bug.go b/termui/show_bug.go index 84337c8b..dc661f0e 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -93,7 +93,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { } v.Clear() - fmt.Fprintf(v, "[q] Save and return [←↓↑→,hjkl] Navigation ") + fmt.Fprintf(v, "[Esc] Save and return [←↓↑→,hjkl] Navigation ") if sb.isOnSide { fmt.Fprint(v, "[a] Add label [r] Remove label") @@ -112,7 +112,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { func (sb *showBug) keybindings(g *gocui.Gui) error { // Return - if err := g.SetKeybinding(showBugView, 'q', gocui.ModNone, sb.saveAndBack); err != nil { + if err := g.SetKeybinding(showBugView, gocui.KeyEsc, gocui.ModNone, sb.saveAndBack); err != nil { return err } diff --git a/termui/termui.go b/termui/termui.go index 581db670..879ec2ea 100644 --- a/termui/termui.go +++ b/termui/termui.go @@ -76,6 +76,8 @@ func initGui(action func(ui *termUI) error) { ui.g.SetManagerFunc(layout) + ui.g.InputEsc = true + err = keybindings(ui.g) if err != nil { |