Rebuild index with Command + Shift + R; also overhaul events.
This commit is contained in:
@@ -40,22 +40,32 @@ class PopoverPanel: NSPanel {
|
||||
}
|
||||
|
||||
override func performKeyEquivalent(with event: NSEvent) -> Bool {
|
||||
Self.logger.debug("performKeyEquivalent keyCode=\(event.keyCode)")
|
||||
let commandKey = NSEvent.ModifierFlags.command.rawValue
|
||||
let modifiers = event.modifierFlags.rawValue
|
||||
let command = NSEvent.ModifierFlags.command.rawValue
|
||||
let shift = NSEvent.ModifierFlags.shift.rawValue
|
||||
let control = NSEvent.ModifierFlags.control.rawValue
|
||||
let option = NSEvent.ModifierFlags.option.rawValue
|
||||
|
||||
if event.type == NSEvent.EventType.keyDown {
|
||||
if (event.modifierFlags.rawValue &
|
||||
NSEvent.ModifierFlags.deviceIndependentFlagsMask.rawValue)
|
||||
== commandKey, event.keyCode == 13 // W
|
||||
{
|
||||
resignKey()
|
||||
return true
|
||||
} else if (event.modifierFlags.rawValue &
|
||||
NSEvent.ModifierFlags.deviceIndependentFlagsMask.rawValue)
|
||||
== commandKey, event.keyCode == 12 // Q
|
||||
// Checks if flags contains a command key,
|
||||
// then check if flags doesn't contain any other keys.
|
||||
if (modifiers & command) == command,
|
||||
(modifiers & (control | shift | option)) == 0,
|
||||
event.keyCode == 12 // Q
|
||||
{
|
||||
NSApplication.shared.terminate(self)
|
||||
return true
|
||||
} else if (modifiers & command) == command,
|
||||
(modifiers & (control | shift | option)) == 0,
|
||||
event.keyCode == 13 // W
|
||||
{
|
||||
resignKey()
|
||||
return true
|
||||
} else if (modifiers & (command & shift)) == command & shift,
|
||||
(modifiers & (control | option)) == 0,
|
||||
event.keyCode == 15 // R
|
||||
{
|
||||
PathManager.shared.rebuildIndex()
|
||||
} else if event.keyCode == 53 { // ESC
|
||||
resignKey()
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user