diff options
author | David Roman <d@vidroman.dev> | 2022-03-15 14:12:26 +0100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:01:28 +1100 |
commit | b8fc829f860a1d6157ebe49f63e1b16db19c950c (patch) | |
tree | b2248bc581aabe4bb026b44a9027b8e13a676ddb /pkg/gui/gui.go | |
parent | 950bb5090dfa8e553b6a066b02547fce427c1acd (diff) |
Record current directory on switch
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index c6dbf1f65..416a2faf7 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -124,6 +124,8 @@ type Gui struct { PopupHandler PopupHandler IsNewRepo bool + + InitialRepoDir string } type listPanelState struct { @@ -447,6 +449,7 @@ func NewGui( updater *updates.Updater, filterPath string, showRecentRepos bool, + initialRepoDir string, ) (*Gui, error) { gui := &Gui{ Common: cmn, @@ -464,6 +467,8 @@ func NewGui( // but now we do it via state. So we need to still support the config for the // sake of backwards compatibility. We're making use of short circuiting here ShowExtrasWindow: cmn.UserConfig.Gui.ShowCommandLog && !config.GetAppState().HideCommandLog, + + InitialRepoDir: initialRepoDir, } guiIO := oscommands.NewGuiIO( @@ -590,7 +595,11 @@ func (gui *Gui) RunAndHandleError() error { switch err { case gocui.ErrQuit: - if !gui.State.RetainOriginalDir { + if gui.State.RetainOriginalDir { + if err := gui.recordDirectory(gui.InitialRepoDir); err != nil { + return err + } + } else { if err := gui.recordCurrentDirectory(); err != nil { return err } |