summaryrefslogtreecommitdiffstats
path: root/pkg/gui/branches_panel.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/branches_panel.go')
-rw-r--r--pkg/gui/branches_panel.go30
1 files changed, 1 insertions, 29 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go
index d7d972ae7..e85e9fd05 100644
--- a/pkg/gui/branches_panel.go
+++ b/pkg/gui/branches_panel.go
@@ -7,8 +7,6 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
- "github.com/jesseduffield/lazygit/pkg/gui/presentation"
- "github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -220,7 +218,7 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions)
func (gui *Gui) handleCheckoutByName() error {
return gui.prompt(promptOpts{
title: gui.Tr.BranchName + ":",
- findSuggestionsFunc: gui.findBranchNameSuggestions,
+ findSuggestionsFunc: gui.getBranchNameSuggestionsFunc(),
handleConfirm: func(response string) error {
return gui.handleCheckoutRef(response, handleCheckoutRefOptions{
span: "Checkout branch",
@@ -535,32 +533,6 @@ func (gui *Gui) handleNewBranchOffCurrentItem() error {
})
}
-func (gui *Gui) getBranchNames() []string {
- result := make([]string, len(gui.State.Branches))
-
- for i, branch := range gui.State.Branches {
- result[i] = branch.Name
- }
-
- return result
-}
-
-func (gui *Gui) findBranchNameSuggestions(input string) []*types.Suggestion {
- branchNames := gui.getBranchNames()
-
- matchingBranchNames := utils.FuzzySearch(sanitizedBranchName(input), branchNames)
-
- suggestions := make([]*types.Suggestion, len(matchingBranchNames))
- for i, branchName := range matchingBranchNames {
- suggestions[i] = &types.Suggestion{
- Value: branchName,
- Label: presentation.GetBranchTextStyle(branchName).Sprint(branchName),
- }
- }
-
- return suggestions
-}
-
// sanitizedBranchName will remove all spaces in favor of a dash "-" to meet
// git's branch naming requirement.
func sanitizedBranchName(input string) string {