From 3b182790c51f20a68c34d9b166cb03a20460019e Mon Sep 17 00:00:00 2001 From: BDisp Date: Fri, 13 Nov 2020 17:37:27 +0000 Subject: [PATCH] Fixes #999. Toplevel should only redraw the subviews if !NeedDisplay.IsEmpty or layoutNeeded. --- Terminal.Gui/Core/Toplevel.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Terminal.Gui/Core/Toplevel.cs b/Terminal.Gui/Core/Toplevel.cs index a200852f2..1baed5f34 100644 --- a/Terminal.Gui/Core/Toplevel.cs +++ b/Terminal.Gui/Core/Toplevel.cs @@ -399,7 +399,7 @@ namespace Terminal.Gui { Application.CurrentView = this; if (IsCurrentTop || this == Application.Top) { - if (!NeedDisplay.IsEmpty) { + if (!NeedDisplay.IsEmpty || layoutNeeded) { Driver.SetAttribute (Colors.TopLevel.Normal); // This is the Application.Top. Clear just the region we're being asked to redraw @@ -407,15 +407,17 @@ namespace Terminal.Gui { Clear (bounds); Driver.SetAttribute (Colors.Base.Normal); PositionToplevels (); - } - foreach (var view in Subviews) { - if (view.Frame.IntersectsWith (bounds)) { - view.SetNeedsLayout (); - view.SetNeedsDisplay (view.Bounds); - } - } - ClearNeedsDisplay (); + foreach (var view in Subviews) { + if (view.Frame.IntersectsWith (bounds)) { + view.SetNeedsLayout (); + view.SetNeedsDisplay (view.Bounds); + } + } + + layoutNeeded = false; + ClearNeedsDisplay (); + } } base.Redraw (base.Bounds);