1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Fix focus issue when opening recent-repos menu at launch

I don't know why we were setting the initial context to CurrentSideContext
and not just CurrentContext in the first place. If there is no current context
in either case it'll default to the files context. So the only issue is if
we anticipated that some random context would be focused and we didn't want to
activate that. But I can't think of any situation where that would happen.
This commit is contained in:
Jesse Duffield
2023-06-07 17:41:17 +10:00
parent b6a31369da
commit c92e687d3b
6 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,28 @@
package misc
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
// Couldn't find an easy way to actually reproduce the situation of opening outside a repo,
// so I'm introducing a hacky env var to force lazygit to show the recent repos meu upon opening.
var RecentReposOnLaunch = NewIntegrationTest(NewIntegrationTestArgs{
Description: "When opening opening to a menu, focus is correctly given to the menu",
ExtraCmdArgs: []string{},
ExtraEnvVars: map[string]string{
"SHOW_RECENT_REPOS": "true",
},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.ExpectPopup().Menu().
Title(Equals("Recent repositories")).
Select(Contains("Cancel")).
Confirm()
t.Views().Files().IsFocused()
},
})