@retrovm/terminal 0.1.2 → 0.1.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/node.js +5 -1
- package/dist/terminal.d.ts +1 -0
- package/dist/terminal.js +5 -1
- package/package.json +1 -1
- package/src/terminal.ts +6 -1
package/dist/node.js
CHANGED
|
@@ -311,6 +311,7 @@ import { format } from "node:util";
|
|
|
311
311
|
class TerminalCore {
|
|
312
312
|
writer;
|
|
313
313
|
plain;
|
|
314
|
+
_altScreen = false;
|
|
314
315
|
constructor(writer, options = {}) {
|
|
315
316
|
this.writer = writer;
|
|
316
317
|
const envNoColor = typeof process !== "undefined" && !!process?.env?.NO_COLOR;
|
|
@@ -402,7 +403,10 @@ class TerminalCore {
|
|
|
402
403
|
return this;
|
|
403
404
|
}
|
|
404
405
|
alt(b = true) {
|
|
405
|
-
|
|
406
|
+
if (b !== this._altScreen) {
|
|
407
|
+
this.emit(`\x1B[?1049${b ? "h" : "l"}`);
|
|
408
|
+
this._altScreen = b;
|
|
409
|
+
}
|
|
406
410
|
return this;
|
|
407
411
|
}
|
|
408
412
|
autoWrap(b = true) {
|
package/dist/terminal.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare class TerminalCore {
|
|
|
40
40
|
private readonly writer;
|
|
41
41
|
/** ANSI is suppressed when true; styling/cursor methods become no-ops. */
|
|
42
42
|
plain: boolean;
|
|
43
|
+
private _altScreen;
|
|
43
44
|
[key: string]: unknown;
|
|
44
45
|
constructor(writer: ITerminalWriter, options?: {
|
|
45
46
|
plain?: boolean;
|
package/dist/terminal.js
CHANGED
|
@@ -311,6 +311,7 @@ import { format } from "node:util";
|
|
|
311
311
|
class TerminalCore {
|
|
312
312
|
writer;
|
|
313
313
|
plain;
|
|
314
|
+
_altScreen = false;
|
|
314
315
|
constructor(writer, options = {}) {
|
|
315
316
|
this.writer = writer;
|
|
316
317
|
const envNoColor = typeof process !== "undefined" && !!process?.env?.NO_COLOR;
|
|
@@ -402,7 +403,10 @@ class TerminalCore {
|
|
|
402
403
|
return this;
|
|
403
404
|
}
|
|
404
405
|
alt(b = true) {
|
|
405
|
-
|
|
406
|
+
if (b !== this._altScreen) {
|
|
407
|
+
this.emit(`\x1B[?1049${b ? "h" : "l"}`);
|
|
408
|
+
this._altScreen = b;
|
|
409
|
+
}
|
|
406
410
|
return this;
|
|
407
411
|
}
|
|
408
412
|
autoWrap(b = true) {
|
package/package.json
CHANGED
package/src/terminal.ts
CHANGED
|
@@ -62,6 +62,8 @@ class TerminalCore {
|
|
|
62
62
|
/** ANSI is suppressed when true; styling/cursor methods become no-ops. */
|
|
63
63
|
public plain: boolean
|
|
64
64
|
|
|
65
|
+
private _altScreen = false;
|
|
66
|
+
|
|
65
67
|
// Allows the auto-attached color methods to typecheck on `this`.
|
|
66
68
|
[key: string]: unknown
|
|
67
69
|
|
|
@@ -212,7 +214,10 @@ class TerminalCore {
|
|
|
212
214
|
|
|
213
215
|
/** Enables or disables the alternate screen buffer. */
|
|
214
216
|
alt(b: boolean = true): this {
|
|
215
|
-
|
|
217
|
+
if (b !== this._altScreen) {
|
|
218
|
+
this.emit(`\x1b[?1049${b ? 'h' : 'l'}`)
|
|
219
|
+
this._altScreen = b
|
|
220
|
+
}
|
|
216
221
|
return this
|
|
217
222
|
}
|
|
218
223
|
|