@tiens.nguyen/gonext-cli 1.0.370 → 1.0.371
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 +19 -5
- package/package.json +1 -1
package/gonext-repl.mjs
CHANGED
|
@@ -722,12 +722,20 @@ function eraseFooter() {
|
|
|
722
722
|
}
|
|
723
723
|
// Shift+Tab redraw: the bar is below the caret, so a plain redraw in place is enough.
|
|
724
724
|
const redrawModeLine = () => drawFooter();
|
|
725
|
+
// Set by the prepended Enter handler, cleared once the resulting line is consumed. It tells
|
|
726
|
+
// the empty-input path that readline really echoed a newline to the terminal (a live
|
|
727
|
+
// keypress) and there is therefore a row to step back onto — as opposed to a line drained
|
|
728
|
+
// from _lineQueue, which produced no echo to undo.
|
|
729
|
+
let enterEchoed = false;
|
|
725
730
|
// Enter must tear the bar down BEFORE readline echoes its newline (which would land the
|
|
726
731
|
// cursor on the rule row and leave the mode line orphaned below the output). Our normal
|
|
727
732
|
// keypress listener runs AFTER readline's, so this one is prepended to run first.
|
|
728
733
|
if (process.stdin.isTTY) {
|
|
729
734
|
process.stdin.prependListener("keypress", (_ch, key) => {
|
|
730
|
-
if (key && (key.name === "return" || key.name === "enter"))
|
|
735
|
+
if (key && (key.name === "return" || key.name === "enter")) {
|
|
736
|
+
enterEchoed = true;
|
|
737
|
+
eraseFooter();
|
|
738
|
+
}
|
|
731
739
|
});
|
|
732
740
|
}
|
|
733
741
|
if (process.stdin.isTTY) {
|
|
@@ -2774,16 +2782,22 @@ async function main() {
|
|
|
2774
2782
|
let lineRaw;
|
|
2775
2783
|
for (;;) {
|
|
2776
2784
|
lineRaw = await nextLine();
|
|
2785
|
+
const echoed = enterEchoed;
|
|
2786
|
+
enterEchoed = false;
|
|
2777
2787
|
if (lineRaw === null || lineRaw.trim()) break;
|
|
2778
|
-
//
|
|
2779
|
-
//
|
|
2780
|
-
//
|
|
2781
|
-
//
|
|
2788
|
+
// EMPTY (or whitespace-only) input is not a question — it must leave NO trace, or a few
|
|
2789
|
+
// stray Enters stack up a column of bare ">>" rows. readline has already echoed its
|
|
2790
|
+
// newline, so step back UP onto the ">> " row it left behind and re-prompt there:
|
|
2791
|
+
// prompt() erases from the caret down, so the row is rewritten in place and the empty
|
|
2792
|
+
// submit becomes a visual no-op. Nothing to step back over if the line came from
|
|
2793
|
+
// _lineQueue (no keypress, no echo) — hence the `echoed` guard.
|
|
2782
2794
|
if (process.stdout.isTTY) {
|
|
2795
|
+
if (echoed) process.stdout.write("\x1b[1A");
|
|
2783
2796
|
footerActive = true;
|
|
2784
2797
|
rl.prompt();
|
|
2785
2798
|
}
|
|
2786
2799
|
}
|
|
2800
|
+
enterEchoed = false;
|
|
2787
2801
|
footerActive = false; // a line arrived from the queue (no Enter keypress) → disarm
|
|
2788
2802
|
if (lineRaw === null) break; // stdin closed
|
|
2789
2803
|
const line = lineRaw.trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.371",
|
|
4
4
|
"description": "GoNext CLI — the gonext terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|