@codexstar/pi-listen 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/voice.ts +5 -11
- package/package.json +1 -1
package/extensions/voice.ts
CHANGED
|
@@ -1091,15 +1091,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1091
1091
|
|
|
1092
1092
|
// ── SPACE handling ──
|
|
1093
1093
|
if (matchesKey(data, "space")) {
|
|
1094
|
-
//
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
clearHoldTimer();
|
|
1098
|
-
clearReleaseTimer();
|
|
1099
|
-
spaceDownTime = null;
|
|
1100
|
-
spaceConsumed = false;
|
|
1101
|
-
return undefined; // let the default space character through
|
|
1102
|
-
}
|
|
1094
|
+
// Check editor content — hold-to-talk still works even with content,
|
|
1095
|
+
// but a quick tap types a space as normal
|
|
1096
|
+
const editorHasContent = !!(ctx?.hasUI && ctx.ui.getEditorText()?.trim().length);
|
|
1103
1097
|
|
|
1104
1098
|
// ── Kitty key-release ──
|
|
1105
1099
|
if (isKeyRelease(data)) {
|
|
@@ -1172,10 +1166,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
1172
1166
|
}
|
|
1173
1167
|
|
|
1174
1168
|
// After threshold: activate voice recording
|
|
1169
|
+
// Works regardless of whether editor has content — hold always activates voice
|
|
1175
1170
|
holdActivationTimer = setTimeout(() => {
|
|
1176
1171
|
holdActivationTimer = null;
|
|
1177
|
-
|
|
1178
|
-
if (voiceState === "idle" && spaceDownTime && !(currentText && currentText.trim().length > 0)) {
|
|
1172
|
+
if (voiceState === "idle" && spaceDownTime) {
|
|
1179
1173
|
spaceConsumed = true;
|
|
1180
1174
|
isHolding = true;
|
|
1181
1175
|
startVoiceRecording("editor").then((ok) => {
|