From 3961fc67626a912a62b5b61787189a0939f4aa26 Mon Sep 17 00:00:00 2001 From: Hamid Afghan Date: Wed, 28 Oct 2026 10:46:04 +0100 Subject: [PATCH] fix: keep composer input ahead of bare shortcuts --- Sources/DevNull/Views/Composer.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sources/DevNull/Views/Composer.swift b/Sources/DevNull/Views/Composer.swift index 4bd396c..674042b 100644 --- a/Sources/DevNull/Views/Composer.swift +++ b/Sources/DevNull/Views/Composer.swift @@ -920,6 +920,22 @@ struct ComposerTextView: NSViewRepresentable { final class SubmittingTextView: NSTextView { weak var coordinator: Coordinator? + /// A bare key equivalent is offered to menu items before AppKit delivers it to the first responder. Keep + /// unmodified text input in the composer, so a global shortcut such as `g` or `c` cannot swallow a letter. + /// Command and Control combinations still go through the normal menu path (for Copy, Paste, and navigation). + override func performKeyEquivalent(with event: NSEvent) -> Bool { + let commandModifiers: NSEvent.ModifierFlags = [.command, .control, .function] + + guard event.modifierFlags.intersection(commandModifiers).isEmpty, + let characters = event.characters, + !characters.isEmpty else { + return super.performKeyEquivalent(with: event) + } + + keyDown(with: event) + return true + } + override func paste(_ sender: Any?) { let pasteboard = NSPasteboard.general