acuvo-code 0.6.7 → 0.6.8
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/lib/input-box.mjs +38 -48
- package/package.json +1 -1
package/lib/input-box.mjs
CHANGED
|
@@ -516,7 +516,7 @@ export function pinRegion(output, { rows = 2, env = process.env } = {}) {
|
|
|
516
516
|
*/
|
|
517
517
|
const enabled = Boolean(output?.isTTY)
|
|
518
518
|
&& height > rows + 4
|
|
519
|
-
&& String(env.
|
|
519
|
+
&& String(env.ACUVO_NO_PIN ?? '') !== '1'
|
|
520
520
|
&& String(env.CI ?? '').toLowerCase() !== 'true';
|
|
521
521
|
|
|
522
522
|
if (!enabled) return { enabled: false, release() {}, rows: 0, bottom: 0 };
|
|
@@ -525,66 +525,56 @@ export function pinRegion(output, { rows = 2, env = process.env } = {}) {
|
|
|
525
525
|
let released = false;
|
|
526
526
|
|
|
527
527
|
/**
|
|
528
|
-
* ──
|
|
528
|
+
* ── ⭐⭐⭐ RESERVE THE ROWS. DO NOT CLEAR THE SCREEN. ────────────────────────
|
|
529
529
|
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
530
|
+
* ⚠️⚠️ THE CLEAR WAS THE ENTIRE BUG, THROUGH FOUR ATTEMPTS. Every previous
|
|
531
|
+
* version began `ESC[H ESC[2J ESC[3J` — home, erase screen, erase scrollback.
|
|
532
|
+
* That is what `clear` emits, and it is completely wrong here for two reasons
|
|
533
|
+
* that took far too long to separate:
|
|
532
534
|
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
535
|
+
* 1. It runs AFTER the banner has been printed, so it erases the thing the
|
|
536
|
+
* user just saw. Roman: "I see the green logo and text for a fraction of
|
|
537
|
+
* a second then I just see the prompt box, nothing else."
|
|
538
|
+
* 2. `3J` deletes the SCROLLBACK — the user's shell history, and then their
|
|
539
|
+
* own session. "Can't scroll up or it's just not there." A CLI has no
|
|
540
|
+
* business destroying the buffer it was launched into.
|
|
537
541
|
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
* ⚠️⚠️ `3J` BEFORE `2J`, AND WITHOUT IT THE PROMPT IS OFF-SCREEN. Roman:
|
|
544
|
-
* *"when you type acuvo you have to scroll down to see the prompt area."*
|
|
545
|
-
*
|
|
546
|
-
* `ESC[2J` clears the visible screen but PUSHES what was there into
|
|
547
|
-
* SCROLLBACK — so VS Code (and most terminals) leave the viewport parked up
|
|
548
|
-
* in the history, showing the old shell output with our banner and prompt
|
|
549
|
-
* below the fold. The user has to scroll to find the thing they just started.
|
|
550
|
-
*
|
|
551
|
-
* `ESC[3J` deletes the scrollback itself, so there is nothing above to be
|
|
552
|
-
* parked in and the viewport has nowhere to sit but the top of a clean
|
|
553
|
-
* screen. Both are needed and the order matters: erase the history, erase the
|
|
554
|
-
* screen, then home.
|
|
555
|
-
*/
|
|
556
|
-
/**
|
|
557
|
-
* ── ⚠️⚠️ THE CANONICAL CLEAR, IN THE CANONICAL ORDER — TWICE WRONG BEFORE ──
|
|
558
|
-
*
|
|
559
|
-
* Roman, twice: *"you have to scroll down to see the prompt area."*
|
|
560
|
-
*
|
|
561
|
-
* What `clear` itself emits is `ESC[H ESC[2J ESC[3J` — HOME FIRST, then erase
|
|
562
|
-
* the screen, then erase the scrollback. I had `3J 2J` with the home last, and
|
|
563
|
-
* the order is not cosmetic: erasing scrollback while the cursor is still
|
|
564
|
-
* parked in it leaves the viewport anchored to a region that no longer exists,
|
|
565
|
-
* so the terminal keeps showing the old shell output and our banner and prompt
|
|
566
|
-
* sit below the fold.
|
|
542
|
+
* ⭐ AND THE REFERENCE NEVER DID THIS. Claude Code does not clear your screen
|
|
543
|
+
* when it starts; your prompt, your previous commands and your scrollback are
|
|
544
|
+
* all still there afterwards. I imported a clear because I was thinking of a
|
|
545
|
+
* full-screen TUI, and then spent four builds fixing the ORDER of an operation
|
|
546
|
+
* that should not have existed.
|
|
567
547
|
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
548
|
+
* ⚠️ THE ROOM IS MADE BY SCROLLING, NOT BY ERASING. Printing `rows` newlines
|
|
549
|
+
* pushes existing content up exactly as any command would, leaving the cursor
|
|
550
|
+
* on the last line with `rows` blank lines below the content. Stepping back up
|
|
551
|
+
* to `bottom` and declaring the region there reserves those lines for the
|
|
552
|
+
* input — and everything above is untouched, still scrollable, still theirs.
|
|
570
553
|
*
|
|
571
|
-
* ⚠️
|
|
572
|
-
*
|
|
573
|
-
*
|
|
554
|
+
* ⚠️ THE CURSOR IS PLACED LAST, AND THAT IS NOT COSMETIC: DECSTBM homes the
|
|
555
|
+
* cursor to (1,1) as a side effect. Without the final move, the first line of
|
|
556
|
+
* output would land at the TOP of the screen and overwrite the banner — which
|
|
557
|
+
* is a quieter version of the same defect this rewrite removes.
|
|
574
558
|
*/
|
|
575
|
-
|
|
559
|
+
const makeRoom = '\n'.repeat(rows);
|
|
560
|
+
output.write(`${makeRoom}${CSI}${rows}A${CSI}1;${bottom}r${CSI}${bottom};1H`);
|
|
576
561
|
|
|
577
562
|
const release = () => {
|
|
578
563
|
if (released) return;
|
|
579
564
|
released = true;
|
|
580
565
|
/**
|
|
581
|
-
* ⚠️ `ESC[r` WITH NO ARGUMENTS RESETS TO THE FULL SCREEN. Then the cursor
|
|
582
|
-
*
|
|
583
|
-
* our
|
|
584
|
-
*
|
|
566
|
+
* ⚠️ `ESC[r` WITH NO ARGUMENTS RESETS TO THE FULL SCREEN. Then the cursor
|
|
567
|
+
* moves below the reserved rows so the shell prompt does not land on top of
|
|
568
|
+
* our input — an exit that is technically correct and visually broken is
|
|
569
|
+
* still a bad exit.
|
|
570
|
+
*
|
|
571
|
+
* ⭐ AND NOTHING IS ERASED ON THE WAY OUT EITHER. The session the user just
|
|
572
|
+
* had stays on screen and in scrollback, which is the whole point of not
|
|
573
|
+
* having taken over their terminal in the first place.
|
|
585
574
|
*/
|
|
586
575
|
try {
|
|
587
|
-
output.write(`${CSI}r${CSI}${height};1H
|
|
576
|
+
output.write(`${CSI}r${CSI}${height};1H
|
|
577
|
+
`);
|
|
588
578
|
} catch { /* the stream may already be gone on a hard exit */ }
|
|
589
579
|
};
|
|
590
580
|
|