-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Better support for utf-8 repl #3243
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
Conversation
This addresses #3242 |
See #3230 (comment) and following.
Disabling |
Currently when a utf8 character that is bigger than 1 byte is typed in the repl, it isn't handled how it should be. If you try to move the cursor in any direction the text gets messed up. This fixes that.
80c494d
to
e00e95e
Compare
e00e95e
to
398be76
Compare
Found a problem with computing the line length, that is fixed with the latest commit. I also rebased this to main and it appears to be fitting on all boards now after the changes @jepler made to make builds smaller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Thank you! @dpgeorge may want this in MicroPython as well.
Thanks for the note; yes this does look useful for us as well! |
This adds some 'utf-8 aware' code to the repl. Anytime the cursor moves or something is typed or deleted, we have to keep track of the number of utf-8 continuation bytes that are involved. This way, the repl behaves as you would expect it to even with characters that are not ascii.
I know space is tight on some of the smaller boards so I tried my best to minimize the impact on code size with this but, it still is causing a few build failures.
I've tested this out on an itsybitsy_m4/m0_express and it seems good on both of those boards.
Let me know what you think!