Skip to content

Raise a prompt on a stray key in command mode instead of passing it - #1476

Draft
nedtwigg wants to merge 6 commits into
mainfrom
issue-68-stray-key-prompt
Draft

nedtwigg wants to merge 6 commits into
mainfrom
issue-68-stray-key-prompt

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Command mode dispatched each key on its own and let an unbound one fall through silently, so a word typed in the wrong mode taught the user nothing at its first letter and fired whatever verbs its later letters spelled: ls -la split at the -, cd minimized, git toggled TODO, exit opened the kill prompt, sudo ran Reopen.

The command-mode chain now ends with a stray-key check: a printed character (Space included) or Backspace, unmodified but for Shift, that no binding claims raises an in-pane "That's not a shortcut" prompt shaped like the kill confirmation. A bound key whose verb is inert on the selection (t on a Door) is not a stray, nor is a key the focused control uses (Space on a button-like control, any key in a text field or select); a bare Wall's digits are, and so is any key on xterm's input proxy. While the prompt shows it answers every key ahead of the dialog gate: Escape dismisses it, Enter dismisses it and then acts as usual, modifiers and host chords pass, and every other key is swallowed, so nothing reaches a verb or the Session. A mode or selection change, or a kill confirmation, takes it down. It lists the command-mode keys, a list a test pins against the real dispatch.

Closes #68.

Design decisions from the maintainer: an in-pane prompt, not a window modal. Space, Backspace, and a bare Wall's digits count as strays. u Reopen stays instant. The prompt answers keys in the chain ahead of the dialog gate, as the kill confirmation does, rather than taking a dialog lease.

Not verified in the live standalone app, VS Code, or the website playground (the playground and tutorial now show the prompt too). Known limit: a command whose first letter is bound (make, docker) still fires that verb.

🤖 Generated with Claude Code

Command mode dispatched each key on its own and let an unbound one fall
through silently, so a word typed in the wrong mode taught the user
nothing at its first letter and fired whatever verbs its later letters
spelled: `ls -la` split at the `-`, `cd` minimized, `git` toggled TODO,
`exit` opened the kill prompt, `sudo` ran Reopen.

The command-mode chain now ends with a stray-key check: a printed
character (Space included) or Backspace, unmodified but for Shift, that
no binding claims raises an in-pane "That's not a shortcut" prompt
shaped like the kill confirmation. A bound key whose verb is inert on
the selection (`t` on a Door) is not a stray; a bare Wall's digits are.
While the prompt shows it answers every key ahead of the dialog gate:
Escape dismisses it, Enter dismisses it and then acts as usual,
modifiers and host chords pass, and every other key is swallowed, so
nothing reaches a verb or the Session. A mode or selection change, or a
kill confirmation, takes it down. It lists the command-mode keys, a
list a test pins against the real dispatch.

Closes #68.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 09124f3
Status: ✅  Deploy successful!
Preview URL: https://dd8f8f86.mouseterm.pages.dev
Branch Preview URL: https://issue-68-stray-key-prompt.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space as a stray preempts Space on a focused Wall control. Details are inline.

nedtwigg and others added 4 commits October 30, 2026 16:25
Tab is unbound in command mode, so it moves DOM focus onto pane-header
controls, and Space is how those activate since Enter is a pane verb.
The stray check claimed Space before they saw it: a focused header
button stopped activating, and the browser URL span raised the prompt
instead of opening its editor. A key the focused control uses (Space on
a button-like control, any key in a text field or select) is no longer
a stray. xterm's input proxy is excluded from that, so a key on it
still raises the prompt and never reaches the PTY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test drives the real command-mode chain, so `Enter`, `a`, and `t`
reach `acknowledgeSession`, `dismissSessionAlert`, and
`toggleSessionTodo`, which read the session activity store and threw
"Platform not initialized" inside the keydown listener. Vitest counted
those as unhandled errors and failed the Library Tests run though every
assertion passed. Mock them as handle-pane-shortcuts.test.ts does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve scripts/spec-word-budgets.json by taking the larger budget per spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve scripts/spec-word-budgets.json by taking the larger budget per spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #1487's story-clock fix for the access-log story, which is the one changed Argos snapshot every open PR showed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Better handling for incorrect characters typed in Command Mode

2 participants