Browse Source

Clamping to maximum size of the buffer

Just an extra sanity check/guard
Brandon Thetford 11 months ago
parent
commit
9082d13e30
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Terminal.Gui/View/Layout/Dim.cs

+ 1 - 1
Terminal.Gui/View/Layout/Dim.cs

@@ -253,7 +253,7 @@ public abstract record Dim : IEqualityOperators<Dim, Dim, bool>
     /// </returns>
     internal virtual int Calculate (int location, int superviewContentSize, View us, Dimension dimension)
     {
-        return Math.Max (GetAnchor (superviewContentSize - location), 0);
+        return Math.Clamp (GetAnchor (superviewContentSize - location), 0, short.MaxValue);
     }
 
     /// <summary>