From badf398a94fbd4fe39eb569ce95b8543c2289c8e Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 11 May 2026 20:42:05 +0200 Subject: [PATCH] Run moveMainContextPairToTop before queueing main-view tasks Copy the outgoing view's content into the target view (the flicker- prevention step) before queuing the render task, rather than after. The task writes the fresh content from a worker goroutine, so with the old order the worker write races the UI-thread copy, and the copy can land last and clobber the fresh content with stale output. This is only needed while view writes happen concurrently. Once view writes are serialized on the UI thread and the view write-mutex goes away, the synchronous copy always precedes the FIFO-queued write regardless of order, so the reorder becomes unnecessary. No code comment is added for it, since that comment would be obsoleted by that work and likely left behind. --- pkg/gui/main_panels.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go index 82f4fcac0..03b7469d2 100644 --- a/pkg/gui/main_panels.go +++ b/pkg/gui/main_panels.go @@ -117,6 +117,8 @@ func (gui *Gui) refreshMainViews(opts types.RefreshMainOpts) { } } + gui.moveMainContextPairToTop(opts.Pair) + if opts.Main != nil { gui.RefreshMainView(opts.Main, opts.Pair.Main) } @@ -127,8 +129,6 @@ func (gui *Gui) refreshMainViews(opts types.RefreshMainOpts) { opts.Pair.Secondary.GetView().Clear() } - gui.moveMainContextPairToTop(opts.Pair) - gui.splitMainPanel(opts.Secondary != nil) }