In nodejs when setting process.stdin.setRawMode(true) the console functionalities get disabled but id like to use the backspace key on the output. something like clearline but for chars.
I have tried turning setRawMode() off then turning it on after the backspace action is finished. it worked for all input added AFTER setRawMode() was disabled.
Thanks.
Okay, so I figured out a solution.
stdin.on("data", (data) => {
buffer += data;
if (data == "\b"){
buffer = buffer.slice(0, buffer.length-2)
stdout.clearLine(0);
stdout.cursorTo(0);
stdout.write(buffer);
return;
}
If there is other solutions id appreciate it. Otherwise, this is functional.