GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(contracts): Space shortcuts reach clients instead of reverting to… · pingdotgg/t3code@31a108c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/contracts/src
    • keybindings.test.ts
    • keybindings.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/contracts/src/keybindings.test.ts‎

Copy file name to clipboardExpand all lines: packages/contracts/src/keybindings.test.ts
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ it.effect("drops resolved rules with commands this build does not know", () =>
3737
}),
3838
);
3939

40+
it.effect("round-trips resolved Space shortcuts", () =>
41+
Effect.gen(function* () {
42+
const codec = Schema.fromJsonString(ResolvedKeybindingsConfig);
43+
const rules = [
44+
{
45+
command: "composer.dictation" as const,
46+
shortcut: { ...shortcut, key: " ", metaKey: true, modKey: false },
47+
},
48+
];
49+
const encoded = yield* Schema.encodeEffect(codec)(rules);
50+
const parsed = yield* decode(codec, encoded);
51+
assert.deepEqual(parsed, rules);
52+
}),
53+
);
54+
4055
it.effect("drops malformed resolved rule entries", () =>
4156
Effect.gen(function* () {
4257
const parsed = yield* decode(ResolvedKeybindingsConfig, [
Collapse file

‎packages/contracts/src/keybindings.ts‎

Copy file name to clipboardExpand all lines: packages/contracts/src/keybindings.ts
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,14 @@ export const KeybindingsConfig = Schema.Array(KeybindingRule).check(
154154
);
155155
export type KeybindingsConfig = typeof KeybindingsConfig.Type;
156156

157+
// Untrimmed: the `space` token resolves to the key " ".
158+
const KeybindingShortcutKey = Schema.String.check(
159+
Schema.isMinLength(1),
160+
Schema.isMaxLength(MAX_KEYBINDING_VALUE_LENGTH),
161+
);
162+
157163
export const KeybindingShortcut = Schema.Struct({
158-
key: KeybindingValue,
164+
key: KeybindingShortcutKey,
159165
metaKey: Schema.Boolean,
160166
ctrlKey: Schema.Boolean,
161167
shiftKey: Schema.Boolean,

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.