From 4df9211e2f039e426ba02859a7d668e40212d90f Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 20 Jul 2023 06:48:17 -0400 Subject: [PATCH] The height can be an infinite number or a NaN, not sure why this could ever happen after setting and limiting a font size between 5 and 72, but this prevents a crash --- Sources/SwiftTerm/Apple/AppleTerminalView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftTerm/Apple/AppleTerminalView.swift b/Sources/SwiftTerm/Apple/AppleTerminalView.swift index c503d67a..2265bc2f 100644 --- a/Sources/SwiftTerm/Apple/AppleTerminalView.swift +++ b/Sources/SwiftTerm/Apple/AppleTerminalView.swift @@ -147,7 +147,7 @@ extension TerminalView { let fontAttributes = [NSAttributedString.Key.font: fontSet.normal] let cellWidth = "W".size(withAttributes: fontAttributes).width #endif - return CellDimension(width: max (1, cellWidth), height: max (cellHeight, 1)) + return CellDimension(width: max (1, cellWidth), height: max (min (cellHeight, 8192), 1)) } func mapColor (color: Attribute.Color, isFg: Bool, isBold: Bool) -> TTColor