How to prevent backspace with readline readable (readable stdin)

I wrote a simple command line user interface program .

For this, I use the Nodejs Readline API to read the process.stdin stream.

My problem is that if the user starts typing, then press backspace, the whole line will be deleted and will return to the default prompt style; until the user presses enter . It looks like this:

 What your phone number?: # User start typing What your phone number?: 123 # User press backspace > 12 

(you can test it by running the example repo examples folder )

Is there a way to prevent this behavior? (or somehow hide it)

+3
source share

Source: https://habr.com/ru/post/1482856/


All Articles