@oxecli/oxe 1.0.18 → 1.0.19
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 +25 -1
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -961,6 +961,22 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
};
|
|
964
|
+
const isNewlineKey = (key) => {
|
|
965
|
+
if (!key)
|
|
966
|
+
return false;
|
|
967
|
+
if (key.name === "enter")
|
|
968
|
+
return true; // bare \n / Ctrl+J
|
|
969
|
+
if (key.name === "return")
|
|
970
|
+
return !!(key.shift || key.ctrl || key.meta);
|
|
971
|
+
// Kitty-keyboard-protocol Shift/Ctrl+Enter (name is "undefined" in Node).
|
|
972
|
+
const seq = key.sequence || "";
|
|
973
|
+
if (seq === "\x1b[13;2u" || seq === "\x1b[13;5u" || seq === "\x1b[13;2~")
|
|
974
|
+
return true;
|
|
975
|
+
// Legacy Shift+Enter decoded as F3 with shift.
|
|
976
|
+
if (key.name === "f3" && key.shift)
|
|
977
|
+
return true;
|
|
978
|
+
return false;
|
|
979
|
+
};
|
|
964
980
|
const onKeypress = (str, key) => {
|
|
965
981
|
if (key && key.ctrl && key.name === "c") {
|
|
966
982
|
settle(new Error("interrupt"), true);
|
|
@@ -970,12 +986,20 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
970
986
|
settle(new Error("eof"), true);
|
|
971
987
|
return;
|
|
972
988
|
}
|
|
973
|
-
|
|
989
|
+
// Plain Enter submits; any modified Enter (Shift/Ctrl+Enter) inserts a
|
|
990
|
+
// newline, mirroring the Python original's _read_input_event (which maps
|
|
991
|
+
// \x1b[13;2u / \x1b[13;5u / Shift+\r to "\n").
|
|
992
|
+
if (key && key.name === "return" && !(key.shift || key.ctrl || key.meta)) {
|
|
974
993
|
if (buffer.trim()) {
|
|
975
994
|
settle([buffer, pasteSpans], false);
|
|
976
995
|
}
|
|
977
996
|
return;
|
|
978
997
|
}
|
|
998
|
+
if (isNewlineKey(key)) {
|
|
999
|
+
insert("\n");
|
|
1000
|
+
repaint();
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
979
1003
|
if (key && key.name === "backspace") {
|
|
980
1004
|
backspace();
|
|
981
1005
|
repaint();
|