Hi Gregor, At 1237059176 time_t, Gregor Best wrote: > the attached patch fixes a thing which has been bugging me for a long time: > If you open a prompt, it lets you enter UTF-8 strings like "αλπψα" just fine, > but if you then want to use BackSpace to remove these UTF-8 glyphs, you have > to > press it twice for each character.
Indeed. :-( > To fix this, i used a "feature" (I > don't know whether that is intended or not) of string:wlen() which was that on > a malformed UTF-8 string, it returns an illogically high number (for example > the string "αλπψα" mangled by sub(1, len() - 1)) yielded something around 4 > billion, which sounds "unlikely" to say the least). Well, it's actually a feature but it was bad implemented. We use mbstowcs() to count UTF-8 string length, but it returns a size_t that we used to push directly on the Lua stack. Unfortunately it returns (size_t) -1 on error, so we push a very big number instead of -1. I've pushed a fix so you will get -1 (5afd2586970e23165c900e03e6ee600e6d5a8ccd). > I patched the BackSpace > part of prompt.run() so that it removes the last two bytes if the difference > of > the wlen()s of the old command and the new command is larger than 1. I did not dig into it, but I used € to test, and it still fails here. Could you check ? Cheers, -- Julien Danjou // ᐰ <jul...@danjou.info> http://julien.danjou.info // 9A0D 5FD9 EB42 22F6 8974 C95C A462 B51E C2FE E5CD // Trust me.
signature.asc
Description: Digital signature