Explorar o código

Support menu items that are null so they can be drawn as a menu separator (#304)

Kasper B. Graversen %!s(int64=5) %!d(string=hai) anos
pai
achega
d4a7cef9cb
Modificáronse 1 ficheiros con 1 adicións e 6 borrados
  1. 1 6
      Terminal.Gui/Views/Menu.cs

+ 1 - 6
Terminal.Gui/Views/Menu.cs

@@ -124,12 +124,7 @@ namespace Terminal.Gui {
 
 		static Rect MakeFrame (int x, int y, MenuItem [] items)
 		{
-			int maxW = 0;
-
-			foreach (var item in items) {
-				var l = item.Width;
-				maxW = Math.Max (l, maxW);
-			}
+			int maxW = items.Max(z=>z?.Width) ?? 0;
 
 			return new Rect (x, y, maxW + 2, items.Length + 2);
 		}