blun-king-cli 2.3.1 → 2.3.2
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/bin/blun.js +21 -14
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -2307,12 +2307,19 @@ async function main() {
|
|
|
2307
2307
|
// Erase everything we drew and move cursor back to start
|
|
2308
2308
|
function eraseUI() {
|
|
2309
2309
|
if (drawnLines <= 0) return;
|
|
2310
|
-
// Move to
|
|
2311
|
-
process.stdout.write("\x1b["
|
|
2312
|
-
|
|
2313
|
-
|
|
2310
|
+
// Move cursor up to where we started drawing
|
|
2311
|
+
process.stdout.write("\x1b[?25l");
|
|
2312
|
+
// Go up drawnLines from current cursor position
|
|
2313
|
+
// Cursor is on content line (line 2), so we need to go up 1 to reach top
|
|
2314
|
+
process.stdout.write("\x1b[" + (drawnLines) + "A\r");
|
|
2315
|
+
// Clear all lines we drew + extra buffer
|
|
2316
|
+
for (var i = 0; i < drawnLines + 3; i++) {
|
|
2317
|
+
process.stdout.write("\x1b[2K");
|
|
2318
|
+
if (i < drawnLines + 2) process.stdout.write("\n");
|
|
2314
2319
|
}
|
|
2315
|
-
|
|
2320
|
+
// Go back up
|
|
2321
|
+
process.stdout.write("\x1b[" + (drawnLines + 3) + "A\r");
|
|
2322
|
+
process.stdout.write("\x1b[?25h");
|
|
2316
2323
|
drawnLines = 0;
|
|
2317
2324
|
}
|
|
2318
2325
|
|
|
@@ -2326,14 +2333,15 @@ async function main() {
|
|
|
2326
2333
|
var lines = 0;
|
|
2327
2334
|
|
|
2328
2335
|
// Box top
|
|
2329
|
-
process.stdout.write(C.brightBlue + " \u256D" + "\u2500".repeat(w - 2) + "\u256E" + C.reset + "\n"); lines++;
|
|
2336
|
+
process.stdout.write("\x1b[2K" + C.brightBlue + " \u256D" + "\u2500".repeat(w - 2) + "\u256E" + C.reset + "\n"); lines++;
|
|
2330
2337
|
// Box content
|
|
2331
|
-
process.stdout.write(C.brightBlue + " \u2502 " + C.reset + C.brightWhite + displayText + C.reset + " ".repeat(pad) + C.brightBlue + "\u2502" + C.reset + "\n"); lines++;
|
|
2338
|
+
process.stdout.write("\x1b[2K" + C.brightBlue + " \u2502 " + C.reset + C.brightWhite + displayText + C.reset + " ".repeat(pad) + C.brightBlue + "\u2502" + C.reset + "\n"); lines++;
|
|
2332
2339
|
// Box bottom
|
|
2333
|
-
process.stdout.write(C.brightBlue + " \u2570" + "\u2500".repeat(w - 2) + "\u256F" + C.reset + "\n"); lines++;
|
|
2340
|
+
process.stdout.write("\x1b[2K" + C.brightBlue + " \u2570" + "\u2500".repeat(w - 2) + "\u256F" + C.reset + "\n"); lines++;
|
|
2334
2341
|
|
|
2335
2342
|
// Status bar (permission mode + model + workdir)
|
|
2336
|
-
var
|
|
2343
|
+
var rawPerm = getSetting("permissions.defaultMode");
|
|
2344
|
+
var permMode = typeof rawPerm === "string" ? rawPerm : "ask";
|
|
2337
2345
|
var permIcon = permMode === "allow" ? "\u2714" : permMode === "deny" ? "\u2718" : "\u2753";
|
|
2338
2346
|
var permColor = permMode === "allow" ? C.green : permMode === "deny" ? C.red : C.yellow;
|
|
2339
2347
|
var modelName = typeof config.model === "string" ? config.model : (config.model && config.model.name ? config.model.name : "default");
|
|
@@ -2341,7 +2349,7 @@ async function main() {
|
|
|
2341
2349
|
var statusLine = permColor + " " + permIcon + " " + permMode + C.reset + C.dim + " \u2502 " + C.reset +
|
|
2342
2350
|
C.cyan + modelName + C.reset + C.dim + " \u2502 " + C.reset +
|
|
2343
2351
|
C.dim + wdShort + C.reset;
|
|
2344
|
-
process.stdout.write(statusLine + "\
|
|
2352
|
+
process.stdout.write("\x1b[2K" + statusLine + "\n"); lines++;
|
|
2345
2353
|
|
|
2346
2354
|
// Menu
|
|
2347
2355
|
if (menuVisible && menuItems.length > 0) {
|
|
@@ -2352,11 +2360,11 @@ async function main() {
|
|
|
2352
2360
|
var descStr = item.desc.slice(0, getTermWidth() - 28);
|
|
2353
2361
|
var cmdColor = i === menuSelected ? C.green + C.bold : C.green;
|
|
2354
2362
|
var descColor = i === menuSelected ? C.brightWhite : C.white;
|
|
2355
|
-
process.stdout.write(prefix + cmdColor + cmdStr + descColor + descStr + C.reset + "\
|
|
2363
|
+
process.stdout.write("\x1b[2K" + prefix + cmdColor + cmdStr + descColor + descStr + C.reset + "\n");
|
|
2356
2364
|
lines++;
|
|
2357
2365
|
});
|
|
2358
2366
|
if (menuItems.length > 8) {
|
|
2359
|
-
process.stdout.write(C.dim + " ... " + (menuItems.length - 8) + " more" + C.reset + "\
|
|
2367
|
+
process.stdout.write("\x1b[2K" + C.dim + " ... " + (menuItems.length - 8) + " more" + C.reset + "\n");
|
|
2360
2368
|
lines++;
|
|
2361
2369
|
}
|
|
2362
2370
|
}
|
|
@@ -2364,8 +2372,7 @@ async function main() {
|
|
|
2364
2372
|
drawnLines = lines;
|
|
2365
2373
|
|
|
2366
2374
|
// Position cursor inside the box (line 2, after text)
|
|
2367
|
-
process.stdout.write("\x1b[" + lines + "A"); // back to
|
|
2368
|
-
process.stdout.write("\x1b[1B"); // down to content line
|
|
2375
|
+
process.stdout.write("\x1b[" + (lines - 1) + "A"); // back to content line
|
|
2369
2376
|
process.stdout.write("\r\x1b[" + (4 + displayText.length) + "C"); // right to cursor pos
|
|
2370
2377
|
process.stdout.write("\x1b[?25h"); // show cursor
|
|
2371
2378
|
}
|