@tiens.nguyen/gonext-local-worker 1.0.305 → 1.0.306
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/gonext-repl.mjs +32 -7
- package/package.json +1 -1
package/gonext-repl.mjs
CHANGED
|
@@ -304,6 +304,8 @@ rl.on("line", (l) => {
|
|
|
304
304
|
slashSel = -1;
|
|
305
305
|
slashNames = [];
|
|
306
306
|
}
|
|
307
|
+
// Overlay is gone — restore readline history so ↑/↓ recall past tasks again (bug #109).
|
|
308
|
+
slashRestoreHistory();
|
|
307
309
|
const clean = stripAnsiEscapes(submitted);
|
|
308
310
|
if (_lineWaiter) {
|
|
309
311
|
const w = _lineWaiter;
|
|
@@ -323,14 +325,39 @@ rl.on("line", (l) => {
|
|
|
323
325
|
// scrollback copies. Relative cursor moves so it survives terminal scrolling.
|
|
324
326
|
// (slashSel / slashNames / slashPrefix are declared above, near rl.on("line").)
|
|
325
327
|
const inputCol = () => 4 + rl.cursor; // ">> " is 3 cols; content starts at col 4 (1-based)
|
|
328
|
+
// While the slash-hint overlay is open, EMPTY readline's history so ↑/↓ don't recall a
|
|
329
|
+
// history entry and trigger readline's OWN line-refresh — that refresh fought our overlay
|
|
330
|
+
// and reprinted the whole ">> /" + hint block on every arrow press (bug #109). With no
|
|
331
|
+
// history to recall, readline's ↑/↓ are inert and our keypress handler owns the highlight.
|
|
332
|
+
// Restored the instant the overlay closes, so normal task-history recall still works.
|
|
333
|
+
let _slashSavedHistory = null;
|
|
334
|
+
function slashNeutralizeHistory() {
|
|
335
|
+
if (_slashSavedHistory === null && Array.isArray(rl.history)) {
|
|
336
|
+
_slashSavedHistory = rl.history;
|
|
337
|
+
rl.history = [];
|
|
338
|
+
rl.historyIndex = -1;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function slashRestoreHistory() {
|
|
342
|
+
if (_slashSavedHistory !== null) {
|
|
343
|
+
rl.history = _slashSavedHistory;
|
|
344
|
+
_slashSavedHistory = null;
|
|
345
|
+
rl.historyIndex = -1;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
326
348
|
function clearSlashHint() {
|
|
327
|
-
if (slashHintRows === 0)
|
|
349
|
+
if (slashHintRows === 0) {
|
|
350
|
+
slashRestoreHistory();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
328
353
|
process.stdout.write("\n\x1b[J" + `\x1b[1A\x1b[${inputCol()}G`);
|
|
329
354
|
slashHintRows = 0;
|
|
330
355
|
slashSel = -1;
|
|
331
356
|
slashNames = [];
|
|
357
|
+
slashRestoreHistory();
|
|
332
358
|
}
|
|
333
359
|
function drawSlashHint(prefix, sel) {
|
|
360
|
+
slashNeutralizeHistory();
|
|
334
361
|
const cmds = filteredCommands(prefix);
|
|
335
362
|
slashNames = cmds.map((c) => c.name);
|
|
336
363
|
if (sel >= cmds.length) sel = cmds.length - 1;
|
|
@@ -370,18 +397,16 @@ if (process.stdin.isTTY) {
|
|
|
370
397
|
}
|
|
371
398
|
// Enter is handled by rl.on("line") — don't redraw the hint on the way out.
|
|
372
399
|
if (key && (key.name === "return" || key.name === "enter")) return;
|
|
373
|
-
// ↑/↓ while the menu is up = move the highlight
|
|
374
|
-
//
|
|
375
|
-
// and
|
|
400
|
+
// ↑/↓ while the menu is up = move the highlight IN PLACE. History is neutralized
|
|
401
|
+
// (slashNeutralizeHistory), so readline's ↑/↓ did nothing — the input line is intact
|
|
402
|
+
// and we just move the selection and redraw the hint below it (bug #109).
|
|
376
403
|
if (slashHintRows > 0 && key && (key.name === "up" || key.name === "down")) {
|
|
377
|
-
rl.
|
|
378
|
-
rl.cursor = slashPrefix.length;
|
|
404
|
+
rl.historyIndex = -1;
|
|
379
405
|
const n = slashNames.length;
|
|
380
406
|
if (n > 0) {
|
|
381
407
|
slashSel =
|
|
382
408
|
key.name === "down" ? (slashSel + 1 + n) % n : (slashSel - 1 + n) % n;
|
|
383
409
|
}
|
|
384
|
-
rl._refreshLine();
|
|
385
410
|
drawSlashHint(slashPrefix, slashSel);
|
|
386
411
|
return;
|
|
387
412
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-local-worker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.306",
|
|
4
4
|
"description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|