fix: give native Quit its Command shortcut during text editing
This commit is contained in:
@@ -94,6 +94,11 @@ extension PlayerModel {
|
||||
}
|
||||
|
||||
func performMenuAction(_ action: PlayerAction) {
|
||||
// Native Command-Quit remains available while a text field owns focus.
|
||||
if action == .quit, NSApp.currentEvent?.modifierFlags.contains(.command) == true {
|
||||
perform(action)
|
||||
return
|
||||
}
|
||||
if let event = NSApp.currentEvent, event.type == .keyDown {
|
||||
if event.isARepeat && !action.allowsRepeat { return }
|
||||
guard let chord = KeyChord.from(event),
|
||||
@@ -162,10 +167,11 @@ struct PlayerCommands: Commands {
|
||||
let bufferInfo = model.bufferInfoAction
|
||||
let snapping = model.snappingAction
|
||||
let automaticQuality = model.automaticQualityAction
|
||||
let quitKeys = model.keyBindings.shortcuts(for: .quit)
|
||||
|
||||
CommandGroup(replacing: .appTermination) {
|
||||
Button("Quit terebi") { model.performMenuAction(.quit) }
|
||||
.keyboardShortcut(model.keyBindings.shortcuts(for: .quit).first?.keyboardShortcut)
|
||||
.keyboardShortcut((quitKeys.first { $0.modifiers.contains(.command) } ?? quitKeys.first)?.keyboardShortcut)
|
||||
.disabled(!model.canPerform(.quit))
|
||||
}
|
||||
CommandGroup(replacing: .newItem) {
|
||||
|
||||
Reference in New Issue
Block a user