awful.prompt: "Fix" for multi-byte characters
commit26d97d0273d59b08a76f1904c630c12b6896e30e
authorUli Schlachter <psychon@znc.in>
Thu, 26 Aug 2010 18:42:22 +0000 (26 20:42 +0200)
committerUli Schlachter <psychon@znc.in>
Thu, 26 Aug 2010 19:07:20 +0000 (26 21:07 +0200)
tree94ef4cdb16d11b0c778eb10bbdc5a0f967fb6f09
parent4ea1753f348e9b4da808b124065fbbd005db4e6f
awful.prompt: "Fix" for multi-byte characters

If you entered a multi-byte character into a prompt and then changed your mind
and used backspace to fix the character, only the last byte of the character was
removed. Because pango is intelligent, it noticed the broken utf8 and
complained.

So far nothing new. But since 711d78b50c23ef8 the textbox will throw a lua error
when it gets an invalid text (= pango complains). Throwing an unprotected lua
error in this context causes the keygrabber to be killed which stops the prompt.

Fix this by removing bytes as long as there are bytes left that can be removed.

This is FS#801.

Signed-off-by: Uli Schlachter <psychon@znc.in>
lib/awful/prompt.lua.in