diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-01 00:24:57 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-02 11:00:15 +1100 |
commit | 872cf0d726485fe1f64788ced180682486d2514d (patch) | |
tree | 73e5998140d8aa1684cdb22559764302f91c5855 /pkg/gui/context.go | |
parent | af09223dd5cd50c5b2a2fe846632a7a0a6e02e1e (diff) |
hide commit files view upon losing focus because you probably don't want it lingering anyway
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r-- | pkg/gui/context.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index 91ec00fb1..036870a5b 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -485,7 +485,7 @@ func (gui *Gui) returnFromContext() error { func (gui *Gui) deactivateContext(c Context) error { // if we are the kind of context that is sent to back upon deactivation, we should do that - if c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP { + if c.GetKind() == TEMPORARY_POPUP || c.GetKind() == PERSISTENT_POPUP || c.GetKey() == COMMIT_FILES_CONTEXT_KEY { _, _ = gui.g.SetViewOnBottom(c.GetViewName()) } @@ -682,6 +682,13 @@ func (gui *Gui) onViewFocusLost(v *gocui.View, newView *gocui.View) error { } } + if v.Name() == "commitFiles" && newView.Name() != "main" && newView.Name() != "secondary" { + gui.resetWindowForView("commitFiles") + if err := gui.deactivateContext(gui.Contexts.CommitFiles.Context); err != nil { + return err + } + } + return nil } |