[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dragoncoder047 opened this issue Mar 23, 2022 · 1 comment

Comments

@dragoncoder047
Copy link

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
Copy link
Author

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

handleReadComplete() {
if (this.history) {
this.history.push(this._input);
}
if (this._activePrompt) {
this._activePrompt.resolve(this._input);
this._activePrompt = null;
}
this.term.write("\r\n");
this._active = false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant