local-echo icon indicating copy to clipboard operation
local-echo copied to clipboard

Multiline editing doesn't fix cursor when user hits enter with cursor halfway up

Open dragoncoder047 opened this issue 3 years ago • 1 comments

So I'm working on a little terminal-based REPL for my programming language Phoo and I found this for the input part. So far works great (though I did have to apply the patch described in #24 to be able to use color prompts and a similar patch as the one in #31 for custom is-complete handlers).

One big problem is when a multiline edit is triggered, the user can move their cursor up, but it isn't moved back down again when they press enter and the command is already complete.

Screenshot 2022-03-22 at 23-17-07 Phoo

In the screenshot I just had the terminal set up to prompt in blue (-> and ..), and then echo the output back again in red.

I typed the first few lines, hit enter with the cursor at the bottom, and it worked fine. I hit 'up', moved the cursor to the middle of the b's, and hit enter from there, and you can see it clobbered over the input prompt and text!

How do I fix this?

dragoncoder047 avatar Mar 23 '22 03:03 dragoncoder047

I'm pretty sure it's somewhere in here:

https://github.com/wavesoft/local-echo/blob/8d0b7f55c5cf4b0b5f7c5132825dc5bd984bf017/lib/LocalEchoController.js#L424-L434

dragoncoder047 avatar Mar 23 '22 03:03 dragoncoder047