@oxecli/oxe 1.0.87 → 1.0.88
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 +30 -8
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -505,13 +505,16 @@ export function displayRows(text) {
|
|
|
505
505
|
// one blank row is preserved between the latest content and the box.
|
|
506
506
|
//
|
|
507
507
|
// dockRel: how many rows the cursor sits above boxTop. 0 = parked at boxTop,
|
|
508
|
-
//
|
|
508
|
+
// 2 = transient content row (spinner/thinking line), with the blank gap row
|
|
509
|
+
// (boxTop-1) kept between it and the box.
|
|
510
|
+
// dockTransient: true while a transient spinner is parked on the content row.
|
|
509
511
|
// dockGap: true when a blank row already exists above the current row (after
|
|
510
512
|
// the box is torn down), so askBottomPrompt does not add a second one.
|
|
511
513
|
let docked = false;
|
|
512
514
|
let dockRel = 0;
|
|
513
515
|
let dockBoxRows = 0;
|
|
514
516
|
let dockGap = false;
|
|
517
|
+
let dockTransient = false;
|
|
515
518
|
let dockFrameLines = [];
|
|
516
519
|
export function dockIsDocked() {
|
|
517
520
|
return docked;
|
|
@@ -528,12 +531,14 @@ export function dockSetInactive() {
|
|
|
528
531
|
dockRel = 0;
|
|
529
532
|
dockBoxRows = 0;
|
|
530
533
|
dockGap = false;
|
|
534
|
+
dockTransient = false;
|
|
531
535
|
dockFrameLines = [];
|
|
532
536
|
}
|
|
533
537
|
export function dockEnterDocked() {
|
|
534
538
|
docked = true;
|
|
535
539
|
dockRel = 0;
|
|
536
540
|
dockGap = false;
|
|
541
|
+
dockTransient = false;
|
|
537
542
|
}
|
|
538
543
|
/** Erase the docked box and leave the cursor at boxTop with the gap above it,
|
|
539
544
|
* so a pager/replay can write there and a later prompt re-docks cleanly. */
|
|
@@ -546,27 +551,41 @@ export function dockTearDown() {
|
|
|
546
551
|
dockFrameLines = [];
|
|
547
552
|
}
|
|
548
553
|
}
|
|
549
|
-
/**
|
|
554
|
+
/** Make a content row two rows above the box for a transient spinner: push the
|
|
555
|
+
* box down one content row, then park the cursor on it with the blank gap
|
|
556
|
+
* row (boxTop-1) preserved between it and the box. Idempotent while parked. */
|
|
550
557
|
export function dockTransientStart() {
|
|
551
558
|
if (!docked || dockBoxRows < 1)
|
|
552
559
|
return;
|
|
553
|
-
if (
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
560
|
+
if (dockTransient)
|
|
561
|
+
return;
|
|
562
|
+
dockEraseBox();
|
|
563
|
+
dockRenderBox();
|
|
564
|
+
process.stdout.write("\x1b[2A\r");
|
|
565
|
+
dockRel = 2;
|
|
566
|
+
dockTransient = true;
|
|
557
567
|
}
|
|
568
|
+
/** Erase the box and any transient rows above it, leaving the cursor at boxTop
|
|
569
|
+
* with the gap row intact above. */
|
|
558
570
|
function dockEraseBox() {
|
|
559
571
|
if (!docked || dockBoxRows < 1)
|
|
560
572
|
return;
|
|
561
|
-
|
|
573
|
+
const rel = dockRel;
|
|
574
|
+
process.stdout.write(`\x1b[${dockBoxRows - 1 + rel}B`);
|
|
562
575
|
for (let i = 0; i < dockBoxRows; i++) {
|
|
563
576
|
process.stdout.write("\r\x1b[K");
|
|
564
577
|
if (i < dockBoxRows - 1)
|
|
565
578
|
process.stdout.write("\x1b[1A");
|
|
566
579
|
}
|
|
580
|
+
if (rel > 0) {
|
|
581
|
+
for (let i = 0; i < rel; i++)
|
|
582
|
+
process.stdout.write("\x1b[1A\r\x1b[K");
|
|
583
|
+
process.stdout.write(`\x1b[${rel}B`);
|
|
584
|
+
}
|
|
567
585
|
docked = false;
|
|
568
586
|
dockRel = 0;
|
|
569
587
|
dockGap = true;
|
|
588
|
+
dockTransient = false;
|
|
570
589
|
}
|
|
571
590
|
function dockEraseBoxKeep() {
|
|
572
591
|
if (!docked || dockBoxRows < 1)
|
|
@@ -581,6 +600,7 @@ function dockEraseBoxKeep() {
|
|
|
581
600
|
docked = false;
|
|
582
601
|
dockRel = 0;
|
|
583
602
|
dockGap = true;
|
|
603
|
+
dockTransient = false;
|
|
584
604
|
}
|
|
585
605
|
/** Write exactly one blank row then the box frame below the current row, and
|
|
586
606
|
* park the cursor at the box top. */
|
|
@@ -592,6 +612,7 @@ function dockRenderBox() {
|
|
|
592
612
|
dockRel = 0;
|
|
593
613
|
docked = true;
|
|
594
614
|
dockGap = false;
|
|
615
|
+
dockTransient = false;
|
|
595
616
|
}
|
|
596
617
|
/** Commit content at the box top, pushing the box down, preserving exactly one
|
|
597
618
|
* blank row between the content and the box. */
|
|
@@ -609,7 +630,8 @@ export function dockAppendContent(text) {
|
|
|
609
630
|
process.stdout.write(`\x1b[${tb}A`);
|
|
610
631
|
dockRenderBox();
|
|
611
632
|
}
|
|
612
|
-
/** Replace a transient spinner row (the
|
|
633
|
+
/** Replace a transient spinner row (two rows above the box) with content,
|
|
634
|
+
* then re-dock, keeping exactly one blank row between content and box. */
|
|
613
635
|
export function dockReplaceTransient(text) {
|
|
614
636
|
if (!text)
|
|
615
637
|
return;
|