native macOS codings agent orchestrator
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(cli-key): lock mixed-case control token semantics

onevpaw f22729ec b464296c

+21 -1
+2
ProwlCLITests/ProwlCLIIntegrationTests.swift
··· 974 974 ("alt-enter", "opt-enter"), 975 975 ("ctrl-z", "ctrl-z"), 976 976 ("A", "shift-a"), 977 + ("Ctrl-A", "shift-ctrl-a"), 978 + ("CTRL-A", "shift-ctrl-a"), 977 979 ("ctrl-left-bracket", "ctrl-left-bracket"), 978 980 ("ctrl-backslash", "ctrl-backslash"), 979 981 ("ctrl-right-bracket", "ctrl-right-bracket"),
+3 -1
doc-onevcat/contracts/cli/key.md
··· 59 59 Rules: 60 60 61 61 - exactly one positional `<token>` is required 62 - - parsing is case-insensitive 63 62 - surrounding spaces are ignored 64 63 - canonical token form is lowercase kebab-case 64 + - modifier names and named-key aliases are parsed case-insensitively 65 + - single printable letters preserve case semantics: lowercase stays plain (`a`), uppercase implies `shift` (`A` -> `shift-a`) 66 + - mixed-case modifier combos keep that printable-letter rule, for example `Cmd-A` -> `cmd-shift-a` and `Ctrl-A` -> `shift-ctrl-a` 65 67 66 68 ### Canonical tokens 67 69
+16
supacodeTests/CLIKeyTokenExpansionTests.swift
··· 31 31 #expect(KeyTokens.normalize("cmd-A") == "cmd-shift-a") 32 32 } 33 33 34 + @Test func normalizesMixedCaseControlTokensWithUppercaseSemantics() { 35 + #expect(KeyTokens.normalize("Ctrl-A") == "shift-ctrl-a") 36 + #expect(KeyTokens.normalize("CTRL-A") == "shift-ctrl-a") 37 + #expect(KeyTokens.normalize("ctrl-a") == "ctrl-a") 38 + #expect(KeyTokens.category(for: "Ctrl-A") == .control) 39 + } 40 + 34 41 @Test func rejectsUnsupportedShiftedSymbolLiterals() { 35 42 #expect(KeyTokens.normalize("!") == nil) 36 43 #expect(KeyTokens.normalize("@") == nil) ··· 78 85 #expect(spec.keyCode == UInt16(kVK_ANSI_A)) 79 86 #expect(spec.modifiers == [.shift]) 80 87 #expect(spec.characters == "A") 88 + #expect(spec.charactersIgnoringModifiers == "a") 89 + } 90 + 91 + @Test func cliKeySpecBuildsMixedCaseControlLetterEvent() throws { 92 + let spec = try #require(CLIKeySpec.from(token: "Ctrl-A")) 93 + 94 + #expect(spec.keyCode == UInt16(kVK_ANSI_A)) 95 + #expect(spec.modifiers == [.control, .shift]) 96 + #expect(spec.characters == String(UnicodeScalar(1)!)) 81 97 #expect(spec.charactersIgnoringModifiers == "a") 82 98 } 83 99