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.
This commit is contained in:
Stefan Haller 2026-05-11 20:42:05 +02:00
parent e53c72be52
commit badf398a94

View file

@ -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)
}