Skip to content

Commit

Permalink
Add terminal reset and cursor display on prompt exit
Browse files Browse the repository at this point in the history
Reset the terminal to normal mode and display the cursor when
exiting the command line prompt.

Generated by gpt-3.5-turbo
  • Loading branch information
joone committed Mar 10, 2024
1 parent be4fa8e commit 1f07ebe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/prompt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export class CommandLinePrompt implements PromptInterface {

exit(): void {
clearInterval(this.timer);
// Show the cursor
process.stdout.write("\x1B[?25h");
// Reset the terminal to the normal mode
process.stdin.setRawMode(false);
this.rl.close();
}
}

0 comments on commit 1f07ebe

Please sign in to comment.