@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.
- package/dist/ui.js +19 -8
- 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
|
-
|
|
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
|
|
1510
|
-
//
|
|
1511
|
-
//
|
|
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
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
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
|
|
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
|
}
|