feat(coding-agent/modes): implemented space-bar hold push-to-talk STT gesture

- Added a space-hold gesture state machine in CustomEditor, tracking repeated spaces, detecting holds beyond SPACE_HOLD_THRESHOLD, and firing start/end callbacks via a release timer.
- Hooked editor space-hold callbacks in InputController so STT toggles on hold start and again on release when STT is enabled.
- Added tests for space-hold start/stop behavior and updated keybinding docs to describe the hold-to-record STT workflow.
This commit is contained in:
can1357
2026-06-14 08:14:30 +02:00
parent c4ed34ea6c
commit ff0fc74f53
9 changed files with 191 additions and 5 deletions
@@ -347,6 +347,12 @@ export class InputController {
for (const key of this.ctx.keybindings.getKeys("app.stt.toggle")) {
this.ctx.editor.setCustomKeyHandler(key, () => void this.ctx.handleSTTToggle());
}
// Hold the space bar to push-to-talk: the editor recognizes the auto-repeat burst, tracks
// the spam back out, and toggles STT on hold start / release. Gated on `stt.enabled` so a
// disabled STT leaves the space bar typing normally.
this.ctx.editor.sttHoldEnabled = () => settings.get("stt.enabled");
this.ctx.editor.onSpaceHoldStart = () => void this.ctx.handleSTTToggle();
this.ctx.editor.onSpaceHoldEnd = () => void this.ctx.handleSTTToggle();
for (const key of this.ctx.keybindings.getKeys("app.clipboard.copyLine")) {
this.ctx.editor.setCustomKeyHandler(key, () => this.handleCopyCurrentLine());
}