diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-11 19:28:32 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-11 19:28:32 +0200 |
commit | 9cbd5b4ee113c660377ffe9c01ca374d6addfef4 (patch) | |
tree | 8720b18cba789d27f28b3ce024f7caa90e93ccc7 /termui/input_popup.go | |
parent | 30e38aab0849d28eaea11c5e1f9f9423a0999e0d (diff) | |
download | git-bug-9cbd5b4ee113c660377ffe9c01ca374d6addfef4.tar.gz |
termui: allow to change the bug query
Diffstat (limited to 'termui/input_popup.go')
-rw-r--r-- | termui/input_popup.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/termui/input_popup.go b/termui/input_popup.go index 00e602e5..c8299d2a 100644 --- a/termui/input_popup.go +++ b/termui/input_popup.go @@ -8,10 +8,12 @@ import ( const inputPopupView = "inputPopupView" +// inputPopup is a simple popup with an input field type inputPopup struct { - active bool - title string - c chan string + active bool + title string + preload string + c chan string } func newInputPopup() *inputPopup { @@ -53,6 +55,7 @@ func (ip *inputPopup) layout(g *gocui.Gui) error { v.Frame = true v.Title = ip.title v.Editable = true + v.Write([]byte(ip.preload)) } if _, err := g.SetCurrentView(inputPopupView); err != nil { @@ -88,6 +91,11 @@ func (ip *inputPopup) validate(g *gocui.Gui, v *gocui.View) error { return nil } +func (ip *inputPopup) ActivateWithContent(title string, content string) <-chan string { + ip.preload = content + return ip.Activate(title) +} + func (ip *inputPopup) Activate(title string) <-chan string { ip.title = title ip.active = true |