@oxecli/oxe 1.0.55 → 1.0.56
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 +19 -34
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -830,60 +830,45 @@ export function renderBufferWithCursor(buffer, pasteSpans, prefix, label, cursor
|
|
|
830
830
|
const totalRows = body.length + 2;
|
|
831
831
|
return { frame, cursorRow, cursorCol, totalRows };
|
|
832
832
|
}
|
|
833
|
-
export function
|
|
833
|
+
export function isShiftEnterKey(str, key) {
|
|
834
834
|
if (!key)
|
|
835
835
|
return false;
|
|
836
836
|
const seq = key.sequence || str || "";
|
|
837
|
-
|
|
838
|
-
// Any modified Enter / Return / Linefeed / Ctrl+J
|
|
839
|
-
if (hasModifier &&
|
|
837
|
+
if (key.shift &&
|
|
840
838
|
(key.name === "return" ||
|
|
841
839
|
key.name === "enter" ||
|
|
842
840
|
key.name === "linefeed" ||
|
|
843
841
|
seq === "\r" ||
|
|
844
|
-
seq === "\n"
|
|
845
|
-
(key.ctrl && key.name === "j"))) {
|
|
842
|
+
seq === "\n")) {
|
|
846
843
|
return true;
|
|
847
844
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
return true;
|
|
854
|
-
// Xterm modifyOtherKeys: \x1b[27;<mod>;13~
|
|
855
|
-
if (/^\x1b\[27;([2-9]|\d{2,});13~$/.test(seq))
|
|
856
|
-
return true;
|
|
857
|
-
// Alt+Enter / Esc+Enter
|
|
858
|
-
if (seq === "\x1b\r" ||
|
|
859
|
-
seq === "\x1b\n" ||
|
|
860
|
-
seq === "\x1b\x0d" ||
|
|
861
|
-
seq === "\x1b\x0a") {
|
|
845
|
+
if (seq === "\x1b[13;2u" ||
|
|
846
|
+
seq === "\x1b[13;2~" ||
|
|
847
|
+
seq === "\x1b[13;2_" ||
|
|
848
|
+
seq === "\x1b[27;2;13~" ||
|
|
849
|
+
seq === "\x1bOM") {
|
|
862
850
|
return true;
|
|
863
851
|
}
|
|
864
|
-
|
|
865
|
-
if (key.name === "f3" && key.shift)
|
|
852
|
+
if (!key.ctrl && (str === "\n" || seq === "\n" || key.name === "linefeed")) {
|
|
866
853
|
return true;
|
|
854
|
+
}
|
|
867
855
|
return false;
|
|
868
856
|
}
|
|
857
|
+
export const isNewlineKey = isShiftEnterKey;
|
|
869
858
|
export function isSubmitEnterKey(str, key) {
|
|
870
859
|
if (!key)
|
|
871
860
|
return false;
|
|
872
|
-
if (
|
|
861
|
+
if (isShiftEnterKey(str, key))
|
|
873
862
|
return false;
|
|
874
863
|
const seq = key.sequence || str || "";
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
if (seq === "\r" && !key.ctrl && !key.shift && !key.meta)
|
|
882
|
-
return true;
|
|
883
|
-
if (seq === "\x1b[13u" || seq === "\x1b[13;1u")
|
|
884
|
-
return true;
|
|
885
|
-
if (seq === "\x1b[27;1;13~")
|
|
864
|
+
if ((key.name === "return" ||
|
|
865
|
+
key.name === "enter" ||
|
|
866
|
+
seq === "\r" ||
|
|
867
|
+
seq === "\x1b[13u" ||
|
|
868
|
+
seq === "\x1b[13;1u") &&
|
|
869
|
+
!key.shift) {
|
|
886
870
|
return true;
|
|
871
|
+
}
|
|
887
872
|
return false;
|
|
888
873
|
}
|
|
889
874
|
export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|