Skip to content

Commit

Permalink
refactor(prompt): use clear method to clear stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Feb 3, 2021
1 parent 1e15d38 commit a6b5d36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion prompt/_generic_input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export abstract class GenericInput<
protected async handleEvent(event: KeyEvent): Promise<void> {
switch (true) {
case event.name === "c" && event.ctrl:
this.tty.cursorLeft.eraseDown.cursorShow();
this.clear();
this.tty.cursorShow();
Deno.exit(0);
return;
case this.isKey(this.settings.keys, "moveCursorLeft", event):
Expand Down
3 changes: 2 additions & 1 deletion prompt/_generic_prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ export abstract class GenericPrompt<
protected async handleEvent(event: KeyEvent): Promise<void> {
switch (true) {
case event.name === "c" && event.ctrl:
this.tty.cursorLeft.eraseDown.cursorShow();
this.clear();
this.tty.cursorShow();
Deno.exit(0);
return;
case this.isKey(this.settings.keys, "submit", event):
Expand Down

0 comments on commit a6b5d36

Please sign in to comment.