-
Notifications
You must be signed in to change notification settings - Fork 133
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
PromptWithSuggestion(): panic with non-ASCII characters #106
Comments
It's a cursor position, so length in runes is correct. You can't place the cursor half way though a rune. Actually, it really should ignore combining code points (and maybe even count doublewidth runes twice), but it's too late to fix that now (it would be an incompatible change to the API). With all that said, it shouldn't crash. Especially since larger-than-string-length is documented to work. |
So if I understand correctly: Avoiding the string-to-[]rune conversion would only be possible with a breaking API change? Thus to avoid breaking the API, the string-to-[]rune conversion is neccessary and cannot be avoided? |
While true, that's not quite what I was trying to say. Allow me to try again:
|
Thanks Peter for taking the time for the detailed response and the fix in 8c1271f - now everything makes sense :-) Learned a bit about terminal design (screen-space vs. Unicode). Also thanks for the I didn't know about Great library of yours 👍 Looking forward to using it more projects. All the best! |
There is also a line which says "works", but I don't usually have to do this conversion with other libraries. Could this be improved inside liner or is this extra conversion really required every time I use
PromptWithSuggestion()
? Could this be optimized? Or maybe is character handling with non-ASCII characters bugged?Please check :-)
Greetings
The text was updated successfully, but these errors were encountered: