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

Can't use backspace #239

Open
mainrs opened this issue Apr 19, 2016 · 2 comments
Open

Can't use backspace #239

mainrs opened this issue Apr 19, 2016 · 2 comments

Comments

@mainrs
Copy link

mainrs commented Apr 19, 2016

I made a video about it: https://youtu.be/WTO5t_LXCV0
I can't use backspace in a native shell on MAC OSX.

@WillyYubin
Copy link

I am facing the same problem. And I have review the source code, it seems like the function of backspace didn't achieve the function of deleting character. Furthermore, I suppose to use the function of 'resetPromptLine' , but the logic of algorithm still wrong. Anyone have a good solution for this problem?

@WillyYubin
Copy link

I have added some code in ConsoleReader.java to solve the backspace problem. The following solution basically solve the problem of backspace.
But there is problem that when I type quicker than computer, the action will pending. The backspace function can't work properly.
If anyone have better solution, please leave comments in this page.

case BACKWARD_DELETE_CHAR: // backspace
int bc = buf.cursor;
String bufbuffer = buf.buffer.toString();
String newbuf = bufbuffer;
if(!newbuf.isEmpty()){
newbuf = newbuf.substring(0, newbuf.length()-1)+" ";
setBuffer(newbuf.toString());
buf.buffer.replace(0, buf.buffer.length(), bufbuffer);
buf.cursor = bc;
flush();
}
success = backspace();
flush();
break;

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

2 participants