Add ansi reset at uninit
This commit is contained in:
parent
c0bde58ac4
commit
bb898ba0a8
3 changed files with 6 additions and 2 deletions
3
TODO.md
3
TODO.md
|
@ -2,7 +2,8 @@
|
|||
|
||||
- Add click events for ansi display
|
||||
- Fix resizing on web_div display
|
||||
- Prevent ctrl+c on web display
|
||||
- Ignore ctrl+c on web display (generally speaking, on displays that does not
|
||||
support proper 'quit')
|
||||
- Optimize drawing to display, by allowing sequences of characters with the same
|
||||
colors (if supported by the display)
|
||||
- Restore ansi terminal properly after exit (ctrl+c does not work anymore, for
|
||||
|
|
|
@ -18,7 +18,7 @@ describe(AnsiTerminalDisplay, () => {
|
|||
await display.init();
|
||||
checkSequence(stdout, "![2J");
|
||||
await display.uninit();
|
||||
checkSequence(stdout, "![2J![2J");
|
||||
checkSequence(stdout, "![2J![2J![?25h!c");
|
||||
});
|
||||
|
||||
it("writes truecolor characters", async () => {
|
||||
|
|
3
ansi.ts
3
ansi.ts
|
@ -34,6 +34,8 @@ export class AnsiTerminalDisplay extends Display {
|
|||
|
||||
async uninit(): Promise<void> {
|
||||
await this.writer.write(CLEAR);
|
||||
await this.setCursorVisibility(true);
|
||||
await this.writer.write(RESET);
|
||||
}
|
||||
|
||||
async flush(): Promise<void> {
|
||||
|
@ -182,6 +184,7 @@ function get256Colors(): readonly Color[] {
|
|||
}
|
||||
|
||||
const CLEAR = escape("[2J");
|
||||
const RESET = escape("c");
|
||||
|
||||
/**
|
||||
* Check if a reader will be compatible with raw mode
|
||||
|
|
Loading…
Reference in a new issue