Browse Source

Merge to pattern check

Actually makes the concurrency problem SLIGHTLY better, but not much
Brandon Thetford 1 year ago
parent
commit
987f7d6454
1 changed files with 12 additions and 17 deletions
  1. 12 17
      Terminal.Gui/View/Layout/ViewLayout.cs

+ 12 - 17
Terminal.Gui/View/Layout/ViewLayout.cs

@@ -566,31 +566,26 @@ public partial class View
 
 
         Rectangle startFrame = start.Frame;
         Rectangle startFrame = start.Frame;
 
 
-        if (start.InternalSubviews is { })
+        if (start.InternalSubviews is { Count: > 0 })
         {
         {
-            int count = start.InternalSubviews.Count;
+            Point boundsOffset = start.GetBoundsOffset ();
+            int rx = x - (startFrame.X + boundsOffset.X);
+            int ry = y - (startFrame.Y + boundsOffset.Y);
 
 
-            if (count > 0)
+            for (int i = start.InternalSubviews.Count - 1; i >= 0; i--)
             {
             {
-                Point boundsOffset = start.GetBoundsOffset ();
-                int rx = x - (startFrame.X + boundsOffset.X);
-                int ry = y - (startFrame.Y + boundsOffset.Y);
+                View v = start.InternalSubviews [i];
 
 
-                for (int i = count - 1; i >= 0; i--)
+                if (v.Visible && v.Frame.Contains (rx, ry))
                 {
                 {
-                    View v = start.InternalSubviews [i];
+                    View? deep = FindDeepestView (v, rx, ry, out resultX, out resultY);
 
 
-                    if (v.Visible && v.Frame.Contains (rx, ry))
+                    if (deep is null)
                     {
                     {
-                        View? deep = FindDeepestView (v, rx, ry, out resultX, out resultY);
-
-                        if (deep is null)
-                        {
-                            return v;
-                        }
-
-                        return deep;
+                        return v;
                     }
                     }
+
+                    return deep;
                 }
                 }
             }
             }
         }
         }