@travetto/terminal 5.0.11 → 5.0.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/package.json +1 -1
- package/src/writer.ts +6 -6
package/package.json
CHANGED
package/src/writer.ts
CHANGED
|
@@ -76,8 +76,8 @@ export class TerminalWriter {
|
|
|
76
76
|
const q = this.#buffer.filter(x => x !== undefined);
|
|
77
77
|
this.#buffer = [];
|
|
78
78
|
if (q.length && restorePosition) {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
this.storePosition(true);
|
|
80
|
+
this.restorePosition();
|
|
81
81
|
}
|
|
82
82
|
if (q.length && !this.#term.output.write(q.join(''))) {
|
|
83
83
|
return new Promise<void>(r => this.#term.output.once('drain', r));
|
|
@@ -86,14 +86,14 @@ export class TerminalWriter {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
write(
|
|
90
|
-
this.#buffer.push(
|
|
89
|
+
write(text: (string | number), beforeAll = false): this {
|
|
90
|
+
beforeAll ? this.#buffer.unshift(text) : this.#buffer.push(text);
|
|
91
91
|
return this;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/** Stores current cursor position, if called multiple times before restore, last one ones */
|
|
95
|
-
storePosition(): this {
|
|
96
|
-
return this.write(Codes.POSITION_SAVE);
|
|
95
|
+
storePosition(beforeAll = false): this {
|
|
96
|
+
return this.write(Codes.POSITION_SAVE, beforeAll);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/** Restores cursor position, will not behave correctly if nested */
|