diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-26 14:23:47 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-26 18:00:46 +1100 |
commit | fe87114074ae72e3c548f5b05fb50a919eda0f94 (patch) | |
tree | 4d5efbb1562a5ed5d922598335d71fdd80ee1412 /pkg/gui/window.go | |
parent | ad7703df65e09d23bb7e709ca9b22251673ac272 (diff) |
don't hide transient views upon losing focus
Diffstat (limited to 'pkg/gui/window.go')
-rw-r--r-- | pkg/gui/window.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pkg/gui/window.go b/pkg/gui/window.go index 88d93d5ae..d347081ab 100644 --- a/pkg/gui/window.go +++ b/pkg/gui/window.go @@ -25,6 +25,10 @@ func (gui *Gui) setWindowContext(c types.Context) { gui.State.WindowViewNameMap = map[string]string{} } + if c.IsTransient() { + gui.resetWindowContext(c) + } + gui.State.WindowViewNameMap[c.GetWindowName()] = c.GetViewName() } @@ -32,10 +36,12 @@ func (gui *Gui) currentWindow() string { return gui.currentContext().GetWindowName() } +// assumes the context's windowName has been set to the new window if necessary func (gui *Gui) resetWindowContext(c types.Context) { - // we assume here that the window contains as its default view a view with the same name as the window - windowName := c.GetWindowName() - if gui.State.WindowViewNameMap[windowName] == c.GetViewName() { - gui.State.WindowViewNameMap[windowName] = windowName + for windowName, viewName := range gui.State.WindowViewNameMap { + if viewName == c.GetViewName() && windowName != c.GetWindowName() { + // we assume here that the window contains as its default view a view with the same name as the window + gui.State.WindowViewNameMap[windowName] = windowName + } } } |