@devries-cameron20 / t3code-1 / commits / 7dc75127c2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Fix duplicate keybinding rule when replacing with an existing rule (#3969)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Kriday Dave committed Jul 18, 2026 at 01:17 UTC 7dc75127c2320a64d8148ad7a09fd30db892d4af
2 files changed +25 -1
apps/server/src/keybindings.test.ts
+22
@@ -411,6 +411,28 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
411 }).pipe(Effect.provide(makeKeybindingsLayer())),
412 );
413
414 + it.effect("replacing with a rule that already exists elsewhere does not duplicate it", () =>
415 + Effect.gen(function* () {
416 + const { keybindingsConfigPath } = yield* ServerConfig.ServerConfig;
417 + yield* writeKeybindingsConfig(keybindingsConfigPath, [
418 + { key: "mod+r", command: "script.run-tests.run" },
419 + { key: "mod+alt+r", command: "script.run-tests.run" },
420 + ]);
421 + yield* Effect.gen(function* () {
422 + const keybindings = yield* Keybindings.Keybindings;
423 + return yield* keybindings.upsertKeybindingRule({
424 + key: "mod+alt+r",
425 + command: "script.run-tests.run",
426 + replace: { key: "mod+r", command: "script.run-tests.run" },
427 + });
428 + });
429 +
430 + const persisted = yield* readKeybindingsConfig(keybindingsConfigPath);
431 + const persistedView = persisted.map(({ key, command }) => ({ key, command }));
432 + assert.deepEqual(persistedView, [{ key: "mod+alt+r", command: "script.run-tests.run" }]);
433 + }).pipe(Effect.provide(makeKeybindingsLayer())),
434 + );
435 +
436 it.effect("removes only the targeted custom keybinding", () =>
437 Effect.gen(function* () {
438 const { keybindingsConfigPath } = yield* ServerConfig.ServerConfig;
apps/server/src/keybindings.ts
+3 -1
@@ -644,7 +644,9 @@ const make = Effect.gen(function* () {
644 const nextConfig = [
645 ...customConfig.filter((entry) => {
646 if (replaceTarget) {
647 - return !isSameKeybindingRule(entry, replaceTarget);
647 + return (
648 + !isSameKeybindingRule(entry, replaceTarget) && !isSameKeybindingRule(entry, rule)
649 + );
650 }
651 return !isSameKeybindingRule(entry, rule);
652 }),