Commit f18103132a
Verified · cmc
Layout: unified · split
Sources/OrgCore/Keymap/Presets.swift +2 −2
| @@ -1122,7 +1122,7 @@ public enum KeymapPreset: String, Sendable, CaseIterable { | |||
| 1122 | keys = "M-s-<up>" | 1122 | keys = "M-s-<up>" |
| 1123 | command = "org.heading.previous" | 1123 | command = "org.heading.previous" |
| 1124 | [[bind]] | 1124 | [[bind]] |
| 1125 | keys = "C-s-q" | 1125 | keys = "C-s-g" |
| 1126 | command = "org.tags.set" | 1126 | command = "org.tags.set" |
| 1127 | [[bind]] | 1127 | [[bind]] |
| 1128 | keys = "s-RET" | 1128 | keys = "s-RET" |
| @@ -1175,7 +1175,7 @@ public enum KeymapPreset: String, Sendable, CaseIterable { | |||
| 1175 | keys = "C-s-s" | 1175 | keys = "C-s-s" |
| 1176 | command = "org.schedule" | 1176 | command = "org.schedule" |
| 1177 | [[bind]] | 1177 | [[bind]] |
| 1178 | keys = "C-s-d" | 1178 | keys = "C-s-e" |
| 1179 | command = "org.deadline" | 1179 | command = "org.deadline" |
| 1180 | [[bind]] | 1180 | [[bind]] |
| 1181 | keys = "C-s-p" | 1181 | keys = "C-s-p" |
Tests/OrgCoreTests/KeymapTests.swift +11
| @@ -115,6 +115,17 @@ struct KeymapTests { | |||
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | /// ⌃⌘Q locks the screen, ⌃⌘D looks up a word, ⌃⌘F toggles full screen and ⌃⌘Space opens | ||
| 119 | /// the character viewer: the app never sees them. | ||
| 120 | @Test func macPresetAvoidsSystemShortcuts() { | ||
| 121 | let reserved = ["q", "d", "f", "SPC"].map { KeyChord($0, [.control, .command]) } | ||
| 122 | for binding in KeymapPreset.mac.keymap.bindings { | ||
| 123 | #expect(!reserved.contains(binding.keys[0]), "\(KeySequence.format(binding.keys)) is \(binding.command)") | ||
| 124 | } | ||
| 125 | #expect(KeymapPreset.mac.keymap.keys(for: "org.tags.set") == [KeyChord("g", [.control, .command])]) | ||
| 126 | #expect(KeymapPreset.mac.keymap.keys(for: "org.deadline") == [KeyChord("e", [.control, .command])]) | ||
| 127 | } | ||
| 128 | |||
| 118 | @Test func shadowedBindingsShowNoKeys() throws { | 129 | @Test func shadowedBindingsShowNoKeys() throws { |
| 119 | var problems: [String] = [] | 130 | var problems: [String] = [] |
| 120 | let map = Keymap.layered([KeymapPreset.emacs.keymap, try Keymap(toml: "[[bind]]\nkeys = \"C-c C-t\"\ncommand = \"app.save\"\n", problems: &problems)]) | 131 | let map = Keymap.layered([KeymapPreset.emacs.keymap, try Keymap(toml: "[[bind]]\nkeys = \"C-c C-t\"\ncommand = \"app.save\"\n", problems: &problems)]) |