Skip to content

fix(keys): reject key chords with empty segments around + - #907

Open
nityanand123gupta wants to merge 1 commit into
modem-dev:mainfrom
nityanand123gupta:fix-keychord-empty-segments
Open

fix(keys): reject key chords with empty segments around +#907
nityanand123gupta wants to merge 1 commit into
modem-dev:mainfrom
nityanand123gupta:fix-keychord-empty-segments

Conversation

@nityanand123gupta

Copy link
Copy Markdown

Problem

parseKeyChord filtered out empty segments after splitting a chord on +, so malformed bindings were silently reinterpreted as different, real shortcuts:

s+       → s
+s       → s
ctrl++s  → ctrl+s
ctrl+s+  → ctrl+s

Fix

  • Recognize the literal +/+ chord before segment validation (since splitting it produces two empty segments that must stay valid).
  • For every other chord, reject any empty segment around + instead of filtering it out.
  • Whitespace-padded valid chords (ctrl + s) continue to parse as before.

Testing

Ran locally (not just written blind):

  • bun test src/extension-api/keys.test.ts src/ui/lib/keymap.test.ts — 36/36 passing, including new coverage for all four malformed cases, the literal-plus compatibility cases, and the keymap-level "malformed chord doesn't claim the real shortcut" case.
  • bun run typecheck — clean.
  • bun run lint — 0 warnings/errors.
  • bun run format:check on the changed files — clean (the repo-wide format:check currently reports ~1000 pre-existing unrelated files; scoped to my 4 changed files only).

Added a patch Changeset per the contribution convention.

Fixes #906

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@nityanand123gupta is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@nityanand123gupta

Copy link
Copy Markdown
Author

Hi! The PR is currently waiting for workflow approval and Vercel authorization. Could a maintainer please approve the pending workflows when convenient? Thanks!

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.

Reject malformed key chords containing empty segments

1 participant