blun-king-cli 7.2.10 → 7.2.12
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/chat.js +31 -13
- package/package.json +1 -1
package/lib/chat.js
CHANGED
|
@@ -40,7 +40,7 @@ var SLASH_COMMANDS = [
|
|
|
40
40
|
var slashNames = SLASH_COMMANDS.map(function (c) { return c[0]; });
|
|
41
41
|
|
|
42
42
|
// ── Layout Constants ─────────────────────────────────────
|
|
43
|
-
var INPUT_PANEL_HEIGHT =
|
|
43
|
+
var INPUT_PANEL_HEIGHT = 6; // 1 gap + top-frame + input + blank + status + bottom-frame
|
|
44
44
|
|
|
45
45
|
function getRows() { return process.stdout.rows || 24; }
|
|
46
46
|
function getCols() { return process.stdout.columns || 80; }
|
|
@@ -460,23 +460,35 @@ function startChat() {
|
|
|
460
460
|
// ── Menu Mode (temporarily disable raw input) ────────
|
|
461
461
|
function enterMenuMode(fn) {
|
|
462
462
|
isInMenu = true;
|
|
463
|
-
// Reset
|
|
463
|
+
// Reset everything for inquirer
|
|
464
464
|
var rows = getRows();
|
|
465
|
+
// Remove scroll region
|
|
465
466
|
process.stdout.write(setScrollRegion(1, rows));
|
|
466
|
-
|
|
467
|
+
// Move cursor below the panel area
|
|
468
|
+
process.stdout.write(cursorTo(rows - INPUT_PANEL_HEIGHT - 1, 1));
|
|
467
469
|
process.stdout.write(showCursor());
|
|
468
|
-
|
|
470
|
+
// Exit raw mode and clean up listeners
|
|
469
471
|
process.stdin.removeAllListeners("data");
|
|
472
|
+
process.stdin.removeAllListeners("keypress");
|
|
473
|
+
try { process.stdin.setRawMode(false); } catch (e) {}
|
|
474
|
+
// Fully reset stdin for inquirer
|
|
470
475
|
process.stdin.pause();
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
476
|
+
// Small delay to let stdin settle before inquirer takes over
|
|
477
|
+
setTimeout(function () {
|
|
478
|
+
fn(function () {
|
|
479
|
+
// Re-enter TUI mode
|
|
480
|
+
isInMenu = false;
|
|
481
|
+
console.clear();
|
|
482
|
+
ui.renderBanner();
|
|
483
|
+
var creds3 = auth.getStoredCredentials();
|
|
484
|
+
if (creds3) {
|
|
485
|
+
console.log(chalk.yellow(" [SYS] Connected as " + (creds3.name || creds3.email || "user") + " | Plan: " + (creds3.plan || "free")));
|
|
486
|
+
}
|
|
487
|
+
setupLayout();
|
|
488
|
+
drawInputPanel();
|
|
489
|
+
startRawInput();
|
|
490
|
+
});
|
|
491
|
+
}, 50);
|
|
480
492
|
}
|
|
481
493
|
|
|
482
494
|
// ── Cleanup ──────────────────────────────────────────
|
|
@@ -602,6 +614,12 @@ function startChat() {
|
|
|
602
614
|
setTimeout(function () {
|
|
603
615
|
// Clear screen, draw banner, then enter TUI mode
|
|
604
616
|
console.clear();
|
|
617
|
+
// Push banner down a few lines
|
|
618
|
+
var rows = getRows();
|
|
619
|
+
var contentHeight = 12; // banner ~6 + info ~3 + padding ~3
|
|
620
|
+
var scrollArea = rows - INPUT_PANEL_HEIGHT;
|
|
621
|
+
var topPadding = Math.max(0, Math.floor((scrollArea - contentHeight) / 2));
|
|
622
|
+
for (var p = 0; p < topPadding; p++) console.log("");
|
|
605
623
|
// Render banner in normal mode first (before scroll region)
|
|
606
624
|
ui.renderBanner();
|
|
607
625
|
var creds2 = auth.getStoredCredentials();
|