mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-09 13:47:11 +02:00
hide commit files view upon losing focus because you probably don't want it lingering anyway
This commit is contained in:
parent
af09223dd5
commit
872cf0d726
@ -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
|
||||
}
|
||||
|
||||
|
@ -40,3 +40,9 @@ func (gui *Gui) resetWindowForView(viewName string) {
|
||||
// we assume here that the window contains as its default view a view with the same name as the window
|
||||
gui.State.WindowViewNameMap[window] = window
|
||||
}
|
||||
|
||||
func (gui *Gui) renderWindow(window string) error {
|
||||
viewName := gui.getViewNameForWindow(window)
|
||||
gui.Log.Warn(viewName)
|
||||
return gui.rerenderView(viewName)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user