diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-11-28 13:14:48 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-11-28 20:48:17 +1100 |
commit | da3b0bf7c8aa6202d5eb9c8178f6648bc695336a (patch) | |
tree | cd0666ae4253469f8f2f1e349357be37bfb3d571 /pkg/gui/list_context.go | |
parent | 90ade3225f55652d40c6f0266e50f5328390f02b (diff) |
Start on supporting auto-suggestions when checking out a branch
switch to other fuzzy package with no dependencies
Diffstat (limited to 'pkg/gui/list_context.go')
-rw-r--r-- | pkg/gui/list_context.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 86271b065..908f35f7b 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -219,7 +219,7 @@ func (lc *ListContext) handleClick(g *gocui.Gui, v *gocui.View) error { newSelectedLineIdx := v.SelectedLineIdx() // we need to focus the view - if err := lc.Gui.switchContext(lc); err != nil { + if err := lc.Gui.pushContext(lc); err != nil { return err } @@ -483,6 +483,23 @@ func (gui *Gui) submodulesListContext() *ListContext { } } +func (gui *Gui) suggestionsListContext() *ListContext { + return &ListContext{ + ViewName: "suggestions", + WindowName: "suggestions", + ContextKey: SUGGESTIONS_CONTEXT_KEY, + GetItemsLength: func() int { return len(gui.State.Suggestions) }, + GetPanelState: func() IListPanelState { return gui.State.Panels.Suggestions }, + OnFocus: func() error { return nil }, + Gui: gui, + ResetMainViewOriginOnFocus: false, + Kind: PERSISTENT_POPUP, + GetDisplayStrings: func() [][]string { + return presentation.GetSuggestionListDisplayStrings(gui.State.Suggestions) + }, + } +} + func (gui *Gui) getListContexts() []*ListContext { return []*ListContext{ gui.menuListContext(), @@ -497,6 +514,7 @@ func (gui *Gui) getListContexts() []*ListContext { gui.stashListContext(), gui.commitFilesListContext(), gui.submodulesListContext(), + gui.suggestionsListContext(), } } |