Skip to content

Fix tapkeyseq hexcode#1602

Merged
kareltucek merged 2 commits into
masterfrom
fix-tapkeyseq-hexcode
Jul 20, 2026
Merged

Fix tapkeyseq hexcode#1602
kareltucek merged 2 commits into
masterfrom
fix-tapkeyseq-hexcode

Conversation

@kareltucek

Copy link
Copy Markdown
Collaborator

Close #1600

Changelog:

  • fix bad template expansion, where the following token might have been discarded. E.g. tapKeySeq hexCodeOf(a) x y may have dropped x.

kareltucek and others added 2 commits July 20, 2026 15:22
tapKeySeq drops a key when a code-expansion command (hexCodeOf / decCodeOf
/ altCodeOf / uCodeOf) appears earlier in the sequence. For example
`tapKeySeq x y hexCodeOf(!) x y` types `x y 2 1 x` instead of `x y 2 1 x y`.

This adds a TapKeySeq test module reproducing the bug on the right half.
It currently fails (the key after the expansion is dropped); the fix
follows in the next commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…pop)

consumeWhite()'s whitespace-skipping loop evaluated `*ctx->at <= 32` before
calling isEnd(). isEnd() may pop an exhausted parser context (such as the
sub-context pushed by tapKeySeq's expandCodes for hexCodeOf/decCodeOf/
altCodeOf/uCodeOf), which moves ctx->at to the parent's next token. Because
the dereference happened first and the loop body then ran ctx->at++, the first
character of that parent token was stepped over and dropped.

Concretely, `tapKeySeq x y hexCodeOf(!) x y` typed `x y 2 1 y` — the `x`
following the expansion was lost. Reordering the condition so isEnd() (and its
context pop) runs before the dereference keeps ctx->at on the restored token.

Verified on uhk-80-right: the TapKeySeq regression test now passes and the
full on-device test suite is green (52/52).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kareltucek
kareltucek merged commit 76ae911 into master Jul 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Templating bug

1 participant