summaryrefslogtreecommitdiffstats
path: root/pkg/gui/main_panels.go
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-10-19 19:07:36 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-12-10 15:57:51 +0100
commit240948b882dffffeb98d2ccecc4241faf258f6f5 (patch)
tree7f0bf17b0eb7d2625744a422754577387b90697b /pkg/gui/main_panels.go
parentcf82e69bbe8ec25facbc354fe61c7ad8a5413ea1 (diff)
Return only visible views from TopViewInWindow
Without this it's not reliably possible to ask whether a given view is visible by asking windowHelper.TopViewInWindow(context.GetWindowName()) == context.GetView() because there could be transient, invisible contexts after it in the Z order. I guess it's a bit of a coincidence that this has never been a problem so far.
Diffstat (limited to 'pkg/gui/main_panels.go')
-rw-r--r--pkg/gui/main_panels.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go
index d3418b628..3dee86f1b 100644
--- a/pkg/gui/main_panels.go
+++ b/pkg/gui/main_panels.go
@@ -39,12 +39,8 @@ func (gui *Gui) moveMainContextToTop(context types.Context) {
view := context.GetView()
topView := gui.helpers.Window.TopViewInWindow(context.GetWindowName())
- if topView == nil {
- gui.Log.Error("unexpected: topView is nil")
- return
- }
- if topView != view {
+ if topView != nil && topView != view {
// We need to copy the content to avoid a flicker effect: If we're flicking
// through files in the files panel, we use a different view to render the
// files vs the directories, and if you select dir A, then file B, then dir