Skip to content

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

Merged
merged 5 commits into from
Aug 10, 2020

Conversation

dunkmann00
Copy link

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!

@dunkmann00
Copy link
Author

This addresses #3242

@tannewt
Copy link
Member

tannewt commented Aug 3, 2020

@jepler @dhalbert Thoughts on how to reduce these build sizes again?

@dhalbert
Copy link
Collaborator

dhalbert commented Aug 3, 2020

See #3230 (comment) and following.

SUPEROPT_VM = 0 saves 300 bytes on a Gemma M0. I would do that only on the translations that need it.

Disabling rtc saves 1516 bytes. I think @deshipu argued persuasively for leaving what's in math, and for pulseio. rtc to me seems less useful on these tiny boards with no crystal. If they want to know the actual time, an external RTC seems appropriate.

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.
@dunkmann00 dunkmann00 force-pushed the support-utf8-repl-take-one branch from 80c494d to e00e95e Compare August 9, 2020 17:14
@dunkmann00 dunkmann00 force-pushed the support-utf8-repl-take-one branch from e00e95e to 398be76 Compare August 9, 2020 18:11
@dunkmann00
Copy link
Author

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.

Copy link
Member

@tannewt tannewt left a 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.

@tannewt tannewt merged commit bccfb8b into adafruit:main Aug 10, 2020
@dpgeorge
Copy link

Thanks for the note; yes this does look useful for us as well!

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

Successfully merging this pull request may close these issues.

4 participants