zames_pro 2.49.2 → 2.49.3
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/dist/input.js +15 -6
- package/package.json +1 -1
package/dist/input.js
CHANGED
|
@@ -739,11 +739,19 @@ export class LineEditor {
|
|
|
739
739
|
// status stays on screen, only the input area is redrawn. This removes the
|
|
740
740
|
// full-screen flicker on terminals like Tabby, where erasing the whole block
|
|
741
741
|
// on every character made the display blink.
|
|
742
|
-
|
|
742
|
+
//
|
|
743
|
+
// `cursorRowInInput` is the cursor's row WITHIN the input area (0-based) as
|
|
744
|
+
// it is currently on screen: we move up exactly that many rows to the input's
|
|
745
|
+
// TOP and clear downward (ESC[J), which also wipes the hint lines below the
|
|
746
|
+
// input. Passing the input's full HEIGHT here (an earlier version did)
|
|
747
|
+
// overshot by `cursorRow` rows whenever the cursor was not on the last visual
|
|
748
|
+
// line, so every keystroke redrew the block one row higher — the input line
|
|
749
|
+
// visibly climbed from the bottom to the top of the screen.
|
|
750
|
+
_eraseInputOnly(cursorRowInInput) {
|
|
743
751
|
if (!this.rendered)
|
|
744
752
|
return;
|
|
745
753
|
const rows = process.stdout.rows || 24;
|
|
746
|
-
const up = Math.min(Math.max(0,
|
|
754
|
+
const up = Math.min(Math.max(0, cursorRowInInput), Math.max(0, rows - 1));
|
|
747
755
|
if (up > 0)
|
|
748
756
|
process.stdout.write(ESC + '[' + up + 'A');
|
|
749
757
|
process.stdout.write(CR + ESC + '[J');
|
|
@@ -833,13 +841,14 @@ export class LineEditor {
|
|
|
833
841
|
if (statusUnchanged) {
|
|
834
842
|
// Count the real input rows via layout (wrapping aware).
|
|
835
843
|
const layOnly = layoutInput(this.promptStr, this.buf, this.cursor, cols);
|
|
836
|
-
const inputLineRows = layOnly.rows.length;
|
|
837
844
|
const suggOnly = this._suggestions();
|
|
838
845
|
const shownOnly = suggOnly.slice(0, 8);
|
|
839
846
|
const linesBelowOnly = shownOnly.length
|
|
840
847
|
? shownOnly.length + (suggOnly.length > shownOnly.length ? 1 : 0)
|
|
841
848
|
: 0;
|
|
842
|
-
|
|
849
|
+
// Move up to the INPUT top using the OLD cursor row (the position that is
|
|
850
|
+
// on screen right now), never the input's height.
|
|
851
|
+
this._eraseInputOnly(this.cursorRowFromTop - this._statusTop);
|
|
843
852
|
let outOnly = '';
|
|
844
853
|
outOnly += layOnly.rows.map((r) => r.prefix + r.text).join(NL);
|
|
845
854
|
if (shownOnly.length) {
|
|
@@ -941,14 +950,14 @@ export class LineEditor {
|
|
|
941
950
|
}
|
|
942
951
|
const cols = process.stdout.columns || 80;
|
|
943
952
|
const lay = layoutInput(this.promptStr, this.buf, this.cursor, cols);
|
|
944
|
-
const inputRows = lay.rows.length;
|
|
945
953
|
const sugg = this._suggestions();
|
|
946
954
|
const shown = sugg.slice(0, 8);
|
|
947
955
|
this._suggestCount = shown.length;
|
|
948
956
|
const linesBelow = shown.length
|
|
949
957
|
? shown.length + (sugg.length > shown.length ? 1 : 0)
|
|
950
958
|
: 0;
|
|
951
|
-
|
|
959
|
+
// Move up to the INPUT top using the OLD cursor row (on screen right now).
|
|
960
|
+
this._eraseInputOnly(this.cursorRowFromTop - this._statusTop);
|
|
952
961
|
let out = lay.rows.map((r) => r.prefix + r.text).join(NL);
|
|
953
962
|
if (shown.length) {
|
|
954
963
|
const maxName = Math.max(...shown.map((c) => c.name.length));
|