patchrelay 0.49.1 → 0.49.3
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/dist/build-info.json
CHANGED
package/dist/cli/watch/App.js
CHANGED
|
@@ -11,6 +11,7 @@ import { buildWatchDetailExportText, exportWatchTextToTempFile, findLastAssistan
|
|
|
11
11
|
import { measureRenderedTextRows } from "./layout-measure.js";
|
|
12
12
|
import { PROMPT_COMPOSER_HINT, measurePromptComposerRows } from "./prompt-layout.js";
|
|
13
13
|
import { clearTransientStatus, defaultTimerApi, setPersistentStatus, showTransientStatus } from "./transient-status.js";
|
|
14
|
+
import { getPromptEditAction } from "./input-keys.js";
|
|
14
15
|
async function postPrompt(baseUrl, issueKey, text, bearerToken) {
|
|
15
16
|
const headers = { "content-type": "application/json" };
|
|
16
17
|
if (bearerToken)
|
|
@@ -258,6 +259,7 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
258
259
|
}, [promptBuffer, promptDraftBeforeHistory, promptHistory, promptHistoryIndex]);
|
|
259
260
|
useInput((input, key) => {
|
|
260
261
|
if (promptMode) {
|
|
262
|
+
const editAction = getPromptEditAction({ input, key, cursor: promptCursor, bufferLength: promptBuffer.length });
|
|
261
263
|
if (key.escape) {
|
|
262
264
|
resetPromptComposer();
|
|
263
265
|
}
|
|
@@ -285,14 +287,14 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
285
287
|
else if (key.downArrow) {
|
|
286
288
|
recallPromptHistory("newer");
|
|
287
289
|
}
|
|
288
|
-
else if (
|
|
290
|
+
else if (editAction === "backspace") {
|
|
289
291
|
if (promptCursor > 0) {
|
|
290
292
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor - 1)}${buffer.slice(promptCursor)}`);
|
|
291
293
|
setPromptCursor((cursor) => Math.max(0, cursor - 1));
|
|
292
294
|
setPromptHistoryIndex(null);
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
|
-
else if (
|
|
297
|
+
else if (editAction === "delete") {
|
|
296
298
|
if (promptCursor < promptBuffer.length) {
|
|
297
299
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor)}${buffer.slice(promptCursor + 1)}`);
|
|
298
300
|
setPromptHistoryIndex(null);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isPromptBackspaceKey(input, key) {
|
|
2
|
+
return key.backspace === true
|
|
3
|
+
|| input === "\u0008"
|
|
4
|
+
|| input === "\u007f"
|
|
5
|
+
|| (key.ctrl === true && input === "h");
|
|
6
|
+
}
|
|
7
|
+
export function isPromptDeleteKey(input, key) {
|
|
8
|
+
return key.delete === true || input === "\u001b[3~";
|
|
9
|
+
}
|
|
10
|
+
export function getPromptEditAction(params) {
|
|
11
|
+
if (isPromptBackspaceKey(params.input, params.key)) {
|
|
12
|
+
return "backspace";
|
|
13
|
+
}
|
|
14
|
+
if (isPromptDeleteKey(params.input, params.key)) {
|
|
15
|
+
// Some terminal stacks normalize physical backspace as `delete` with
|
|
16
|
+
// empty input. At end-of-line, treat that as backward delete so prompt
|
|
17
|
+
// editing still works instead of turning into a no-op.
|
|
18
|
+
if (params.input === "" && params.cursor >= params.bufferLength) {
|
|
19
|
+
return "backspace";
|
|
20
|
+
}
|
|
21
|
+
return "delete";
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|