Browse Source

Fixed layout issue when contentsize changed.

Tig 1 năm trước cách đây
mục cha
commit
513eb135c6

+ 2 - 2
Terminal.Gui/View/Adornment/Adornment.cs

@@ -149,7 +149,7 @@ public class Adornment : View
             return;
         }
 
-        //Rectangle prevClip = SetClip ();
+        Rectangle prevClip = SetClip ();
 
         Rectangle screen = ViewportToScreen (viewport);
         Attribute normalAttr = GetNormalColor ();
@@ -176,7 +176,7 @@ public class Adornment : View
 
         if (Driver is { })
         {
-           // Driver.Clip = prevClip;
+           Driver.Clip = prevClip;
         }
 
         ClearLayoutNeeded ();

+ 1 - 0
Terminal.Gui/View/ViewContent.cs

@@ -151,6 +151,7 @@ public partial class View
 
         if (e.Cancel != true)
         {
+            SetNeedsLayout ();
             SetNeedsDisplay ();
         }
 

+ 4 - 1
UICatalog/Scenarios/VirtualContent.cs

@@ -40,7 +40,8 @@ public class VirtualContent : Scenario
             KeyBindings.Add (Key.CursorLeft, Command.ScrollLeft);
             KeyBindings.Add (Key.CursorRight, Command.ScrollRight);
 
-            Border.Add (new Label { X = 23 });
+            // Add a status label to the border. Bit of a hack.
+            Border.Add (new Label { AutoSize = false, X = 20 });
             LayoutComplete += VirtualDemoView_LayoutComplete;
 
             MouseEvent += VirtualDemoView_MouseEvent;
@@ -82,6 +83,8 @@ public class VirtualContent : Scenario
             if (status is { })
             {
                 status.Title = $"Frame: {Frame}\n\nViewport: {Viewport}, ContentSize = {ContentSize}";
+                status.Width = Border.Frame.Width - status.Frame.X - Border.Thickness.Right;
+                status.Height = Border.Thickness.Top;
             }
 
             SetNeedsDisplay ();