Skip to content

Commit

Permalink
Fixes cmd - delete hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
glushchenko committed Aug 8, 2019
1 parent cdc7871 commit 51e89cc
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions FSNotes/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,6 @@ class ViewController: NSViewController,
UserDefaultsManagement.focusInEditorOnNoteSelect
? [.command, .option]
: [.command]

if UserDefaultsManagement.focusInEditorOnNoteSelect {
return true
} else if vc.editArea.hasFocus() {
return false
}
}

if ["fileMenu.new", "fileMenu.newRtf", "fileMenu.searchAndCreate", "fileMenu.import"].contains(menuItem.identifier?.rawValue) {
Expand Down Expand Up @@ -533,6 +527,11 @@ class ViewController: NSViewController,
self.alert = nil
return true
}

if event.keyCode == kVK_Delete && event.modifierFlags.contains(.command) && editArea.hasFocus() {
editArea.deleteToBeginningOfLine(nil)
return false
}

// Return / Cmd + Return navigation
if event.keyCode == kVK_Return {
Expand Down Expand Up @@ -871,12 +870,6 @@ class ViewController: NSViewController,
return
}

let menuItem = sender as? NSMenuItem
if vc.editArea.hasFocus() && menuItem?.tag != 555 {
vc.editArea.deleteToBeginningOfLine(nil)
return
}

if let si = vc.getSidebarItem(), si.isTrash() {
removeForever()
return
Expand Down Expand Up @@ -914,6 +907,8 @@ class ViewController: NSViewController,

vc.editArea.clear()
}

NSApp.mainWindow?.makeFirstResponder(vc.notesTableView)
}

@IBAction func archiveNote(_ sender: Any) {
Expand Down

0 comments on commit 51e89cc

Please sign in to comment.