I am making a command line interface to a Forth system running on an Arduino Nano using node.jsr. I am finding when trying to edit a line before accepting it with the enter key that I get unexpected results. When I press the left or right arrow keys I get ^[[D and ^[[C respectively rather than the cursor moving left or right. The following code provides an example:
process.stdin.on('data', (data) => {
process.stdout.write(data)
});
If you run the above code, type a few characters then try to move back with the left arrow, ^[[D shows up rather than the cursor moving to the left. Does anyone know how to correct this behaviour?