1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Update repo switch logic

We now always re-use the state of the repo if we're returning to it, and we always reset the windows to their default tabs.

We reset to default tabs because it's easy to implement. If people want to:
* have tab states be retained when switching
* have tab states specific to the current repo retained when switching back

Then we'll need to revisit this
This commit is contained in:
Jesse Duffield
2023-07-27 18:51:27 +10:00
parent 9c15ba0c0b
commit ae66f720f5
7 changed files with 49 additions and 33 deletions

View File

@ -5,8 +5,15 @@ import (
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RetainedWindowFocus = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that the focused context in each window is retained when switching worktrees",
// This is verifying logic that is subject to change (we're just doing the easiest approach)
// There are two other UX flows we could have:
// 1) associate window tab states with the repo, so that when you switch back to a repo you get the same window tab states
// 2) retain the same window tab states when switching repos
// Option 1 is straightforward, but option 2 is harder because you'd need to deactivate any views containing dependent
// content e.g. the sub-commits view.
var ResetWindowTabs = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that window tabs are reset whenever switching repos",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
@ -39,7 +46,7 @@ var RetainedWindowFocus = NewIntegrationTest(NewIntegrationTestArgs{
// navigate back to the branches window
Press(keys.Universal.NextBlock)
t.Views().Remotes().
t.Views().Branches().
IsFocused()
},
})