Attempting to create a terminal-like experience in JS, I am looking to generate the word 'current source, current location' (e.g., admin@ubuntuTLS~$: ~/Desktop) at the beginning which cannot be removed. Also, I want to prevent the caret from being moved back in front of it. I have tried using window.range() on 'input' event to achieve this without moving the caret:
However, this approach did not work as expected. I am unsure about what steps I should take next.