Skip to content

fix: Trim stale keycodes when keyboard.json layout shrinks#922

Merged
yoichiro merged 1 commit intomainfrom
fix/visual-editor-stale-keycodes
Apr 11, 2026
Merged

fix: Trim stale keycodes when keyboard.json layout shrinks#922
yoichiro merged 1 commit intomainfrom
fix/visual-editor-stale-keycodes

Conversation

@yoichiro
Copy link
Copy Markdown
Collaborator

@yoichiro yoichiro commented Apr 11, 2026

Summary

  • When a key is removed from keyboard.json, subsequent Visual Editor edits previously left the deleted keycodes behind in keymap.c because localKeymap still held the original keycodeNames array.
  • applyKeymapUpdate now trims each layer's keycodeNames to the current layout key count, so every edit path (key change, layer add/delete) keeps keymap.c in sync with the layout.

Test plan

  • npm run type-check passes
  • npm run lint (no new errors from this change)
  • npm test -- --run src/services/workbench src/components/workbench (173 tests pass)
  • Manual: shrink a keyboard.json layout, then edit via Visual Editor and confirm stale keycodes no longer appear in keymap.c

🤖 Generated with Claude Code

When a key is removed from keyboard.json, subsequent Visual Editor edits
previously left the deleted keycodes in keymap.c because localKeymap still
held the original keycodeNames array. Trim each layer's keycodeNames to
the current layout key count inside applyKeymapUpdate so every edit path
(key change, layer add/delete) keeps keymap.c in sync with the layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yoichiro yoichiro merged commit aa8b926 into main Apr 11, 2026
1 check passed
@yoichiro yoichiro deleted the fix/visual-editor-stale-keycodes branch April 11, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant