From fefd4ca04ddd1629232539ded6d60ece84aeded5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 13 Dec 2023 13:49:39 -0800 Subject: [PATCH] macos: style changes, make equivalent not an optional --- macos/Sources/Ghostty/SurfaceView.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/macos/Sources/Ghostty/SurfaceView.swift b/macos/Sources/Ghostty/SurfaceView.swift index 943f308f0..f0ec0f656 100644 --- a/macos/Sources/Ghostty/SurfaceView.swift +++ b/macos/Sources/Ghostty/SurfaceView.swift @@ -838,17 +838,18 @@ extension Ghostty { return false } - let equivalent: String? + let equivalent: String switch (event.charactersIgnoringModifiers) { case "/": - // Treat C-/ as C-_ + // Treat C-/ as C-_. We do this because C-/ makes macOS make a beep + // sound and we don't like the beep sound. equivalent = "_" + default: - equivalent = nil + // Ignore other events + return false } - guard let equivalent else { return false } - let newEvent = NSEvent.keyEvent( with: .keyDown, location: event.locationInWindow,