summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-02-23 21:53:30 +1100
committerJesse Duffield <jessedduffield@gmail.com>2020-02-24 22:18:04 +1100
commit46be280c921994ba783b8c53232d118f0547ad14 (patch)
tree0f2e637414a54e2dd034081f0fce888346e31655 /pkg/gui/branches_panel.go
parent2a5763a77190a579ae3cb57926a0d907964fcccb (diff)
support searching in side panels
For now we're just doing side panels, because it will take more work to support this in the various main panel contexts
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index a683a2342..251b112d8 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -400,6 +400,7 @@ func (gui *Gui) onBranchesTabClick(tabIndex int) error {
func (gui *Gui) switchBranchesPanelContext(context string) error {
branchesView := gui.getBranchesView()
branchesView.Context = context
+ branchesView.ClearSearch()
contextTabIndexMap := map[string]int{
"local-branches": 0,
@@ -444,3 +445,19 @@ func (gui *Gui) handleCreateResetToBranchMenu(g *gocui.Gui, v *gocui.View) error
return gui.createResetMenu(branch.Name)
}
+
+func (gui *Gui) onBranchesPanelSearchSelect(selectedLine int) error {
+ branchesView := gui.getBranchesView()
+ switch branchesView.Context {
+ case "local-branches":
+ gui.State.Panels.Branches.SelectedLine = selectedLine
+ return gui.handleBranchSelect(gui.g, branchesView)
+ case "remotes":
+ gui.State.Panels.Remotes.SelectedLine = selectedLine
+ return gui.handleRemoteSelect(gui.g, branchesView)
+ case "remote-branches":
+ gui.State.Panels.RemoteBranches.SelectedLine = selectedLine
+ return gui.handleRemoteBranchSelect(gui.g, branchesView)
+ }
+ return nil
+}