Skip to content

Fix blank lines accumulating between keymaps array and postamble#916

Merged
yoichiro merged 1 commit intomainfrom
fix/generator-blank-lines-accumulation
Mar 26, 2026
Merged

Fix blank lines accumulating between keymaps array and postamble#916
yoichiro merged 1 commit intomainfrom
fix/generator-blank-lines-accumulation

Conversation

@yoichiro
Copy link
Copy Markdown
Collaborator

@yoichiro yoichiro commented Mar 26, 2026

Summary

  • Fixed a bug where each Visual Editor round-trip (parse → generate) added an extra blank line between the }; closing the keymaps array and the postamble code (e.g.,
    layer_state_set_user)
  • Root cause: generateKeymapC() appended };\n before the postamble, but the postamble already starts with \n from the parser — resulting in a duplicated newline
    on every cycle
  • Added a round-trip regression test that verifies blank lines stay stable across 5 consecutive parse/generate cycles

Test plan

  • All 154 workbench tests pass
  • Open a keymap.c with postamble code in the Workbench
  • Edit a key in the Visual Editor, switch to Code Editor — verify no extra blank lines appear
  • Repeat several times — verify blank lines do not accumulate

🤖 Generated with Claude Code

…postamble

The generator was adding an extra newline after "};" before appending the
postamble, which already starts with a newline. Each Visual Editor round-trip
(parse → generate) added one more blank line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yoichiro yoichiro merged commit 62c8f0f into main Mar 26, 2026
1 check passed
@yoichiro yoichiro deleted the fix/generator-blank-lines-accumulation branch March 26, 2026 10:06
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