@oxecli/oxe 1.0.21 → 1.0.22

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 +6 -6
  2. package/package.json +1 -1
package/dist/ui.js CHANGED
@@ -200,9 +200,9 @@ titleAlign = "center") {
200
200
  contentW = Math.max(contentW, 1);
201
201
  let innerW = contentW + 2;
202
202
  if (title)
203
- innerW = Math.max(innerW, title.length + 2);
203
+ innerW = Math.max(innerW, plainLen(title) + 2);
204
204
  if (subtitle)
205
- innerW = Math.max(innerW, subtitle.length + 2);
205
+ innerW = Math.max(innerW, plainLen(subtitle) + 2);
206
206
  const w = terminalWidth();
207
207
  innerW = expand ? Math.max(w - 4, 10) : Math.min(innerW, w - 4);
208
208
  // Build a border run of `innerW` chars with `text` embedded.
@@ -210,7 +210,7 @@ titleAlign = "center") {
210
210
  if (!text)
211
211
  return "─".repeat(innerW);
212
212
  const inner = ` ${text} `;
213
- const fill = Math.max(innerW - inner.length, 0);
213
+ const fill = Math.max(innerW - plainLen(text) - 2, 0);
214
214
  if (align === "left") {
215
215
  return `${inner}${"─".repeat(fill)}`;
216
216
  }
@@ -690,7 +690,7 @@ export function renderBufferWithCursor(buffer, pasteSpans, prefix, label, cursor
690
690
  }
691
691
  const { rows, caretRow, caretCol } = wrapRuns(runs, innerW);
692
692
  // Top border with the label embedded on the left.
693
- const topPad = Math.max(borderW - label.length - 2, 0);
693
+ const topPad = Math.max(borderW - label.length - 3, 0);
694
694
  const top = `\x1b[90m╭─ ${label} ${"─".repeat(topPad)}╮\x1b[0m`;
695
695
  // Body rows.
696
696
  const body = [];
@@ -975,7 +975,7 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
975
975
  return false;
976
976
  // Bare \n / Ctrl+J = newline.
977
977
  if (key.name === "enter")
978
- return true;
978
+ return !!(key.shift || key.ctrl || key.meta);
979
979
  // Enter with a modifier (Shift/Ctrl/Alt/Meta) = newline.
980
980
  if (key.name === "return")
981
981
  return !!(key.shift || key.ctrl || key.meta);
@@ -998,7 +998,7 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
998
998
  const isSubmitEnterKey = (key) => {
999
999
  if (!key)
1000
1000
  return false;
1001
- if (key.name === "return" && !(key.shift || key.ctrl || key.meta))
1001
+ if ((key.name === "return" || key.name === "enter") && !(key.shift || key.ctrl || key.meta))
1002
1002
  return true;
1003
1003
  const seq = key.sequence || "";
1004
1004
  if (seq === "\x1b[13u" || /^\x1b\[13;1u$/.test(seq))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },