mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -04:00
Filter the recent repositories menu as you type
Picking a repository out of that list is the other place where the menu is a list to search rather than a set of commands, and its items have no keys that typing could clash with. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bb7e74968b
commit
4116a15dae
|
|
@ -153,7 +153,11 @@ func (self *ReposHelper) CreateRecentReposMenu() error {
|
|||
}
|
||||
})
|
||||
|
||||
return self.c.Menu(types.CreateMenuOptions{Title: self.c.Tr.RecentRepos, Items: menuItems})
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.RecentRepos,
|
||||
Items: menuItems,
|
||||
FilterAsYouType: true,
|
||||
})
|
||||
}
|
||||
|
||||
// SwitchToParentRepo switches back to the repo the current submodule was
|
||||
|
|
|
|||
37
pkg/integration/tests/misc/filter_recent_repos.go
Normal file
37
pkg/integration/tests/misc/filter_recent_repos.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package misc
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var FilterRecentRepos = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Switching to a recent repository by typing part of its name",
|
||||
ExtraCmdArgs: []string{},
|
||||
ExtraEnvVars: map[string]string{
|
||||
"SHOW_RECENT_REPOS": "true",
|
||||
},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
// the first entry is the repo we're in, so it isn't offered
|
||||
current, _ := filepath.Abs(".")
|
||||
other, _ := filepath.Abs("../other")
|
||||
target, _ := filepath.Abs("../target")
|
||||
cfg.GetAppState().RecentRepos = []string{current, other, target}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CloneNonBare("other")
|
||||
shell.CloneNonBare("target")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Recent repositories")).
|
||||
Filter("target").
|
||||
Lines(Contains("target").IsSelected()).
|
||||
Confirm()
|
||||
|
||||
t.Views().Status().Content(Contains("target → master"))
|
||||
},
|
||||
})
|
||||
|
|
@ -360,6 +360,7 @@ var tests = []*components.IntegrationTest{
|
|||
misc.DirenvApprovesEnvrc,
|
||||
misc.DirenvLoadedOnRepoSwitch,
|
||||
misc.DirenvUnloadsOnBlockedEnvrc,
|
||||
misc.FilterRecentRepos,
|
||||
misc.InitialOpen,
|
||||
misc.RecentReposOnLaunch,
|
||||
misc.StartInGitDir,
|
||||
|
|
|
|||
Loading…
Reference in a new issue