From 12024ed8310c73e793bf286a18c226135487ab46 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Thu, 1 Jan 2026 08:52:53 -0500 Subject: [PATCH] macos: simplify .keyDown guard condition This condition is more naturally expressed as a `guard`. --- .../Ghostty/Surface View/SurfaceView_AppKit.swift | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index f9a5480ec..fcff6cd8b 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -1181,16 +1181,9 @@ extension Ghostty { /// Special case handling for some control keys override func performKeyEquivalent(with event: NSEvent) -> Bool { - switch (event.type) { - case .keyDown: - // Continue, we care about key down events - break - - default: - // Any other key event we don't care about. I don't think its even - // possible to receive any other event type. - return false - } + // We only care about key down events. It might not even be possible + // to receive any other event type here. + guard event.type == .keyDown else { return false } // Only process events if we're focused. Some key events like C-/ macOS // appears to send to the first view in the hierarchy rather than the