@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.
Files changed (2) hide show
  1. package/dist/ui.js +19 -34
  2. 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 isNewlineKey(str, key) {
833
+ export function isShiftEnterKey(str, key) {
834
834
  if (!key)
835
835
  return false;
836
836
  const seq = key.sequence || str || "";
837
- const hasModifier = !!(key.shift || key.ctrl || key.meta);
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
- // Kitty protocol: \x1b[13;<mod>u (mod 2=Shift, 3=Alt, 5=Ctrl, 6=Ctrl+Shift, etc.)
849
- if (/^\x1b\[13;([2-9]|\d{2,})u$/.test(seq))
850
- return true;
851
- // Legacy kitty/xterm: \x1b[13;<mod>~
852
- if (/^\x1b\[13;([2-9]|\d{2,})~$/.test(seq))
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
- // F3 Shift decode in legacy Node
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 (isNewlineKey(str, key))
861
+ if (isShiftEnterKey(str, key))
873
862
  return false;
874
863
  const seq = key.sequence || str || "";
875
- const isPlainEnterName = (key.name === "return" || key.name === "enter") &&
876
- !key.shift &&
877
- !key.ctrl &&
878
- !key.meta;
879
- if (isPlainEnterName)
880
- return true;
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 = []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },