summaryrefslogtreecommitdiffstats
path: root/pkg/gui/recent_repos_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-03 13:43:43 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commitf1d7f59e497a2da9066494d04f26e1ff00a0e4ee (patch)
treef51b629766de0778f4e6b9cd37f44af9db0edaad /pkg/gui/recent_repos_panel.go
parentbc9a99387f68afb24863d17ab4d29c1686843a76 (diff)
switching repos without restarting the gui
Diffstat (limited to 'pkg/gui/recent_repos_panel.go')
-rw-r--r--pkg/gui/recent_repos_panel.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go
index 691e63d68..c219e1001 100644
--- a/pkg/gui/recent_repos_panel.go
+++ b/pkg/gui/recent_repos_panel.go
@@ -5,6 +5,7 @@ import (
"path/filepath"
"github.com/fatih/color"
+ "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/env"
"github.com/jesseduffield/lazygit/pkg/utils"
@@ -24,6 +25,9 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
yellow.Sprint(path),
},
onPress: func() error {
+ // if we were in a submodule, we want to forget about that stack of repos
+ // so that hitting escape in the new repo does nothing
+ gui.RepoPathStack = []string{}
return gui.dispatchSwitchToRepo(path)
},
}
@@ -73,8 +77,14 @@ func (gui *Gui) dispatchSwitchToRepo(path string) error {
return err
}
gui.GitCommand = newGitCommand
- gui.State.Modes.Filtering.Reset()
- return gui.Errors.ErrSwitchRepo
+
+ gui.g.Update(func(*gocui.Gui) error {
+ gui.resetState("")
+
+ return nil
+ })
+
+ return nil
}
// updateRecentRepoList registers the fact that we opened lazygit in this repo,