From 807f1fdcc886f3b87901c0abc905a516491fdb98 Mon Sep 17 00:00:00 2001 From: BDisp Date: Fri, 25 Jul 2025 12:54:14 +0100 Subject: [PATCH] Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly (#4205) * Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly * Reformat to run CI again * Revert "Reformat to run CI again" This reverts commit 3efad83f5288216135d36983dff4bbcfbfdcfdd6. * Revert "Fixes #4204. v2win and v2net aren't refreshing the Character Map correctly" This reverts commit 6ec4adcc4555893343f723028cd9bb43d95d380f. * Apply @tig suggested changes * Fixes #4208. MainLoopSyncContext doesn't work with the v2 drivers * Trying fix unit test error * Revert "Trying fix unit test error" This reverts commit 3aaefd6053f7c6e237f4faca536494e49424712b. --------- Co-authored-by: Tig --- Terminal.Gui/ViewBase/View.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Terminal.Gui/ViewBase/View.cs b/Terminal.Gui/ViewBase/View.cs index 2061ef482..720f0d428 100644 --- a/Terminal.Gui/ViewBase/View.cs +++ b/Terminal.Gui/ViewBase/View.cs @@ -245,12 +245,13 @@ public partial class View : IDisposable, ISupportInitializeNotification } } - if (ApplicationImpl.Instance.IsLegacy) - { - // TODO: Figure out how to move this out of here and just depend on LayoutNeeded in Mainloop - Layout (); // the EventLog in AllViewsTester fails to layout correctly if this is not here (convoluted Dim.Fill(Func)). - } + // Force a layout each time a View is initialized + // See: https://github.com/gui-cs/Terminal.Gui/issues/3951 + // See: https://github.com/gui-cs/Terminal.Gui/issues/4204 + Layout (); // the EventLog in AllViewsTester fails to layout correctly if this is not here (convoluted Dim.Fill(Func)). + // Complex layout scenarios (e.g. DimAuto and PosAlign) may require multiple layouts to be performed. + // Thus, we call SetNeedsLayout() to ensure that the layout is performed at least once. SetNeedsLayout (); Initialized?.Invoke (this, EventArgs.Empty);