patchrelay 0.49.2 → 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,7 +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 {
|
|
14
|
+
import { getPromptEditAction } from "./input-keys.js";
|
|
15
15
|
async function postPrompt(baseUrl, issueKey, text, bearerToken) {
|
|
16
16
|
const headers = { "content-type": "application/json" };
|
|
17
17
|
if (bearerToken)
|
|
@@ -259,6 +259,7 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
259
259
|
}, [promptBuffer, promptDraftBeforeHistory, promptHistory, promptHistoryIndex]);
|
|
260
260
|
useInput((input, key) => {
|
|
261
261
|
if (promptMode) {
|
|
262
|
+
const editAction = getPromptEditAction({ input, key, cursor: promptCursor, bufferLength: promptBuffer.length });
|
|
262
263
|
if (key.escape) {
|
|
263
264
|
resetPromptComposer();
|
|
264
265
|
}
|
|
@@ -286,14 +287,14 @@ export function App({ baseUrl, bearerToken, initialIssueKey }) {
|
|
|
286
287
|
else if (key.downArrow) {
|
|
287
288
|
recallPromptHistory("newer");
|
|
288
289
|
}
|
|
289
|
-
else if (
|
|
290
|
+
else if (editAction === "backspace") {
|
|
290
291
|
if (promptCursor > 0) {
|
|
291
292
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor - 1)}${buffer.slice(promptCursor)}`);
|
|
292
293
|
setPromptCursor((cursor) => Math.max(0, cursor - 1));
|
|
293
294
|
setPromptHistoryIndex(null);
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
|
-
else if (
|
|
297
|
+
else if (editAction === "delete") {
|
|
297
298
|
if (promptCursor < promptBuffer.length) {
|
|
298
299
|
setPromptBuffer((buffer) => `${buffer.slice(0, promptCursor)}${buffer.slice(promptCursor + 1)}`);
|
|
299
300
|
setPromptHistoryIndex(null);
|
|
@@ -7,3 +7,18 @@ export function isPromptBackspaceKey(input, key) {
|
|
|
7
7
|
export function isPromptDeleteKey(input, key) {
|
|
8
8
|
return key.delete === true || input === "\u001b[3~";
|
|
9
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
|
+
}
|