@oxecli/oxe 1.0.63 → 1.0.64
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/ui.js +23 -0
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -965,6 +965,10 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
965
965
|
let bracketedPasteBuffer = "";
|
|
966
966
|
let pasteBurst = false;
|
|
967
967
|
let pasteBurstTimer = null;
|
|
968
|
+
// Accumulator for modifier-prefixed CSI sequences (e.g. Shift+Enter sent as
|
|
969
|
+
// `\x1b[27;2;13~`), which Node's readline splits into several keypress
|
|
970
|
+
// events instead of one, so they must be reassembled here.
|
|
971
|
+
let modSeq = "";
|
|
968
972
|
readline.emitKeypressEvents(process.stdin);
|
|
969
973
|
if (process.stdin.isTTY) {
|
|
970
974
|
process.stdin.setRawMode(true);
|
|
@@ -1313,6 +1317,25 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
1313
1317
|
}, 500);
|
|
1314
1318
|
};
|
|
1315
1319
|
const onKeypress = (str, key) => {
|
|
1320
|
+
// Reassemble a modifier-prefixed CSI sequence that readline splits up,
|
|
1321
|
+
// e.g. Shift+Enter arriving as `\x1b[27;2;` + "1" + "3" + "~".
|
|
1322
|
+
if (key?.sequence === "\x1b[27;2;") {
|
|
1323
|
+
modSeq = "\x1b[27;2;";
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
if (modSeq) {
|
|
1327
|
+
modSeq += str || key?.sequence || "";
|
|
1328
|
+
if (modSeq.endsWith("~")) {
|
|
1329
|
+
const full = modSeq;
|
|
1330
|
+
modSeq = "";
|
|
1331
|
+
// `\x1b[27;2;13~` is Shift+Enter (modifier 2 = shift, key 13 = Enter).
|
|
1332
|
+
if (full === "\x1b[27;2;13~") {
|
|
1333
|
+
insert("\n");
|
|
1334
|
+
repaint();
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1316
1339
|
if (consumeBracketedPaste(str, key))
|
|
1317
1340
|
return;
|
|
1318
1341
|
if (pasteBurst && str && str.length === 1 && !key?.ctrl && !key?.meta) {
|