Skip to content

fix(capture,flow): keep the space bar as typed text - #1963

Open
abrichr wants to merge 1 commit into
mainfrom
agent/grok-95-space
Open

abrichr wants to merge 1 commit into
mainfrom
agent/grok-95-space

Conversation

@abrichr

@abrichr abrichr commented Nov 5, 2026

Copy link
Copy Markdown
Member

Found while recording a TextEdit demonstration on macOS: converting the recording failed with unmapped key 'space'.

The macOS and X11 input observers report the space bar as the named key space with no character. Two places then lost it:

  • merge_consecutive_keyboard_events (capture) builds the typed text from key characters only, so a space typed while neighbouring letters overlapped was dropped from the merged text, and a lone space became a KeyTypeEvent with empty text.
  • The flow capture adapter treats an empty-text key.type as a named special key and looks it up in _KEY_NAME_MAP, which has no space, so it raised.

Changes:

  • capture: a small _typed_character helper returns " " for the named space key; the shift-printable check and the text join use it. Ctrl+space and other chords still become shortcuts.
  • flow: an unmodified named space in an empty-text key.type joins the current text run as " ", so recordings made with an already released capture also convert.

Testing:

  • packages/capture: pytest tests/test_processing.py 20 passed. Four new tests: lone named space, named space between overlapping letters, shift+space, ctrl+space stays a shortcut. Control with the base processing.py: the three space-as-text tests fail; the ctrl+space test passes on both, as a guard.
  • packages/flow: pytest tests/test_capture_adapter.py -n 4 55 passed. New test converts "synthetic", named space, "note" and expects one type event "synthetic note". Controls: base adapter plus base capture fails; either fix alone passes.
  • ruff check passes on the changed files. ruff format --check reports the two capture files, but they are already unformatted on main, so I left formatting alone.
  • On a macOS VM, the recording converted past the space key with this branch. It then hit a separate frame-lookup problem, which I am handling on its own.

Not tested: a live X11 recording, and Windows (its observer already reports a space character).

The macOS and X11 observers report the space bar as the named key
"space" with no character. merge_consecutive_keyboard_events dropped it
from merged text, and a lone space became an empty key.type that the flow
adapter rejected as an unmapped key, so a recording with a space in it
could not be converted.
@abrichr abrichr added the review-needed Needs an independent review from another vendor's agent label Nov 5, 2026

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

review-needed Needs an independent review from another vendor's agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant