Commit bd3ef3d82a
bd3ef3d82a420bd737269276214670667ab691dc
parent: 1579064da0
Verified · cmc
cmc <hello@cleberg.net> · 2026-10-08 03:29 UTC
Drop the unreachable C-c C-e export dialog binding
C-c C-e is the prefix of C-c C-e h h and the other export keys, so the
dispatcher always waited for the next key and the dialog binding never
ran. As in Org, C-c C-e now only starts the export keys, whose pending
hints list the formats; the dialog stays in the command palette. A test
checks that no preset binding is also a prefix.
Layout: unified · split
Sources/OrgCore/Keymap/Presets.swift
−3
| @@ -753,9 +753,6 @@ public enum KeymapPreset: String, Sendable, CaseIterable { |
| 753 | 753 | keys = "C-c C-x A" |
| 754 | 754 | command = "org.archive.to-sibling" |
| 755 | 755 | [[bind]] |
| 756 | | keys = "C-c C-e" |
| 757 | | command = "app.export-dialog" |
| 758 | | [[bind]] |
| 759 | 756 | keys = "C-c C-x C-v" |
| 760 | 757 | command = "org.toggle-inline-images" |
| 761 | 758 | [[bind]] |
Sources/Orgstar/ExportSheet.swift
+1 −1
| @@ -1,7 +1,7 @@ |
| 1 | 1 | import AppKit |
| 2 | 2 | import SwiftUI |
| 3 | 3 | |
| 4 | | /// C-c C-e: the format, where the file goes, and whether to open it after. |
| 4 | /// Export… (`app.export-dialog`): the format, where the file goes, and whether to open it after. |
| 5 | 5 | struct ExportSheet: View { |
| 6 | 6 | let source: URL |
| 7 | 7 | let export: (_ format: String, _ destination: URL, _ open: Bool) -> Void |
Tests/OrgCoreTests/KeymapTests.swift
+11
| @@ -126,6 +126,17 @@ struct KeymapTests { |
| 126 | 126 | #expect(KeymapPreset.mac.keymap.keys(for: "org.deadline") == [KeyChord("e", [.control, .command])]) |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | /// A binding whose keys start a longer live binding never runs: the dispatcher waits for more. |
| 130 | @Test func presetsBindNoPrefixes() { |
| 131 | for preset in KeymapPreset.allCases { |
| 132 | let keymap = preset.keymap |
| 133 | for binding in keymap.bindings where !binding.unbinds && keymap.isLive(binding) { |
| 134 | #expect(!keymap.isPrefix(binding.keys, mode: binding.mode), |
| 135 | "\(preset): \(KeySequence.format(binding.keys)) (\(binding.command)) is also a prefix") |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 129 | 140 | @Test func shadowedBindingsShowNoKeys() throws { |
| 130 | 141 | var problems: [String] = [] |
| 131 | 142 | let map = Keymap.layered([KeymapPreset.emacs.keymap, try Keymap(toml: "[[bind]]\nkeys = \"C-c C-t\"\ncommand = \"app.save\"\n", problems: &problems)]) |