@oxecli/oxe 1.0.113 → 1.0.114

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 -8
  2. package/package.json +1 -1
package/dist/ui.js CHANGED
@@ -1503,18 +1503,29 @@ export function renderBufferWithCursor(buffer, pasteSpans, prefix, label, cursor
1503
1503
  let totalRows = body.length + 2;
1504
1504
  if (hints && (hints.left || hints.right)) {
1505
1505
  let left = hints.left ?? "";
1506
- const right = hints.right ?? "";
1506
+ let right = hints.right ?? "";
1507
1507
  // Inset the hint row inside the box (box spans columns 0..boxW-1): a
1508
1508
  // leading space gives left-edge padding, and the right hint ends one
1509
- // column before the box's right border for the same padding. Truncate the
1510
- // left hint so the row never exceeds the box width on narrow terminals
1511
- // (otherwise it overflows past the right border instead of scaling down).
1509
+ // column before the box's right border for the same padding. Truncate so
1510
+ // the row NEVER exceeds the box width on narrow/scaled terminals: the left
1511
+ // hint is cut first to keep the (priority) right hint intact, then the
1512
+ // right hint is cut as a last resort. Otherwise a long right hint would
1513
+ // overflow past the border instead of scaling down.
1512
1514
  const hintMax = boxW - 2;
1513
- if (plainLen(left) + plainLen(right) + 1 > hintMax) {
1514
- const room = Math.max(0, hintMax - plainLen(right) - 1);
1515
- left = truncateStyled(left, room);
1515
+ const maxText = Math.max(0, hintMax - 1); // reserve a >=1 gap between hints
1516
+ let leftW = plainLen(left);
1517
+ let rightW = plainLen(right);
1518
+ if (leftW + rightW > maxText) {
1519
+ const roomL = Math.max(0, maxText - rightW);
1520
+ left = truncateStyled(left, roomL);
1521
+ leftW = plainLen(left);
1516
1522
  }
1517
- const gap = Math.max(1, boxW - 2 - plainLen(left) - plainLen(right));
1523
+ const roomR = Math.max(0, maxText - leftW);
1524
+ if (rightW > roomR) {
1525
+ right = truncateStyled(right, roomR);
1526
+ rightW = plainLen(right);
1527
+ }
1528
+ const gap = Math.max(1, hintMax - leftW - rightW);
1518
1529
  lines.push(" " + left + " ".repeat(gap) + right);
1519
1530
  totalRows += 1;
1520
1531
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },