heapwolf / prompt-sync

a synchronous prompt for node.js
MIT License
211 stars 42 forks source link

Every time I type a letter, the line repeats itself #44

Closed ThatOneCalculator closed 2 years ago

ThatOneCalculator commented 3 years ago
const prompt = require('prompt-sync')();
const go = prompt('Every time I type a letter, the prompt is repeated.\n');

Screenshot

jsjain commented 3 years ago

This is happening for me as well, but only when the question ends with \n or \t

ThatOneCalculator commented 3 years ago

This is happening for me as well, but only when the question ends with \n or \t

Yeah. I'm just using sync-prompt now lol.

harsh-sri commented 3 years ago

don't use \n.

@ThatOneCalculator @jsjain

jsjain commented 3 years ago

I need to show a new line after displaying the question.

harsh-sri commented 3 years ago

I need to show a new line after displaying the question.

for next command?

jsjain commented 3 years ago

no for users to enter answer to the question

paiva-thiago commented 2 years ago

It happens here in windows when I use the git prompt or the powershell.

Tusharnalawade11 commented 2 years ago

no for users to enter answer to the question

Use another console.log for that

joshuabremerdexcom commented 2 years ago

If it's not clear to people, this is what I did:

const prompt = require('prompt-sync')();

console.info('Are you sure you want to continue? (y/N)');
if (prompt('> ').toLowerCase() !== 'y') {
  logger.info('Exiting!');
  process.exit(1);
}
ThePhilgrim commented 2 years ago

I have the same issue when the prompt question is too long (even without an explicit \n.

let foo = prompt("Great, the field will be 10x10. How many percent do you want to be covered in mines? (Enter a number between 1 - 60): ")

creates the same issue.

ThatOneCalculator commented 2 years ago

Point being don't use this package. Please stop pinging me with this it's been literally a year geez