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
Looping History with Unicode Items #7
Comments
Yes, there appears to be a mistake in how multibyte characters are counted. I'm looking into it now. |
Nope. I was mistaken. Multibyte characters are handled properly as far as moving the internal cursor around. The issue is actually caused by fullwidth characters and how they are treated by terminals. Solving this problem will be a bit more interesting. Fortunately, there already exists a crate for computing the width of a string, so the most confusing part is already done. |
Linefeed seems know the total chars (i.e. 5 for "ls 世界") in buffer. But when moving cursor, it seems cursor moves over bytes (two moves on surface of char "界") instead of chars (or boundary), compare to bash. |
That was my first thought, as well, but it turned out to be wrong. Other multibyte characters such as "ü" and "•" were being treated correctly. What's actually happening is that the terminal application considers characters such as "世" (called fullwidth characters) to be occupying two columns. I've corrected by this checking for fullwidth characters (using the simple and wonderful I've just committed this change. Please let me know if it solves the problem or if you encounter any other issues. |
Just checked with master, it solved the issue! Awesome! Thanks a lot! |
You're welcome and thanks for filing the issue. Also, I've just published the fix on crates.io as version |
When adding history and fetch them back with
Ctrl+P
, Unicode item would result wrong buffer rendering.Then, let's fetch items back with
Ctrl+P
:Though, when you hit ENTER now, you will get output "hi", which means this is only a rendering issue. It is actually "echo hi" in buffer, not "lsecho hi".
The text was updated successfully, but these errors were encountered: