Replies: 3 comments
-
|
Very nice work, @Josverl thanks for sharing. Looks like you're behind a few versions :) I've been busy in the past few weeks, do you think you will also implement width(), center(), rjust(), wrap(), iter_graphemes(), etc. ? I added these new API functions in 0.3.0 because of thorough analysis of downstream dependencies and found wc/swidth() is not used correctly in almost every case, so I am offering these more correct and battle-tested solutions (mostly ported from blessed library) I'm surprised by your decision to use a small self-clearing dict_cache of size 128, this would give sawtooth performance variation, but I see lru_cache is not available in micropython which is surprising, it is very efficient last I looked, it I see that lru_cache is not in std micropython so that explains it -- I've looked at its source in python and it doesn't appear to use anything unavailable to micropython but this is eyesight only I may be mistaken. In any case, we use "UDHR Datasets" and have benchmarks now in this repository you might borrow from if performance is important to you. Version 0.2.14 release accidentally included a |
Beta Was this translation helpful? Give feedback.
-
I noticed the updates.
My current goal is to see if I can improve the MicroPython REPL and input / readline processing wrt to unicode. If I may ask: what would you suggest as the best/proper API to use for that ? |
Beta Was this translation helpful? Give feedback.
-
|
I designed In any case the algorithm for a single-line REPL would be some variation of the width() function. For a multi-line REPL, you're basically writing an editor, and something like pyte might help. Or at least to take a look. For the ability to move your cursor around complex ZWJ emoji, Flags, or even just simple combining takes some care, while editing, like a REPL would want, you'll need to use iter_graphemes() like what is done in pyte updated by my pr And anytime you get lost, you can always ask the terminal "where is the cursor?" but there is a round-trip delay over network/serial/etc |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Just a small thank you, and to let you know that I've been able to re-use this work for MicroPython in a reduced form.
https://github.com/Josverl/mp_wcwidth
Beta Was this translation helpful? Give feedback.
All reactions