On 02.03.2012 18:47, Anurag Priyam wrote: > On Fri, Mar 2, 2012 at 11:47 AM, Uli Schlachter <[email protected]> wrote: >> On 21.02.2012 16:47, Anurag Priyam wrote: > [...] >>> Lua's C stack based API is not very intuitive (or maybe I haven't got >>> a hang of it yet). Hope I have got it right. The patch does seem to >>> work here. >> >> This patch broke awful.prompt. The keygrabber never gets stopped. I guess >> that's >> because the "return false" in that code gets ignored, but it should already >> have >> called keygrabber.stop() before that. Let's see if this can be figured out... > > Right, keygrabber doesn't stop if you press 'Escape' to close the > prompt.
Yeah, I could see why that happens (I haven't actually tried it). However, I successfully started a program with the prompt (via pressing enter and all that) and still had this problem. This is the part which I still don't understand. > awful.prompt is quite messy that way: a giant (>200 lines) of > callback to `keygrabber.run` with too many return true and false. The "return true" would just be replaced by "return" and I only count a single "return false". I don't say this code is great, but the patch wouldn't be all that bad. > That's why I have been postponing a patch to replace all `return > false` with `keygrabber.stop`. I wonder if a better approach would be > to do something like: > > capi.keygrabber.run(function () > if not grabber() then capi.keygrabber.stop() > end > > Where `grabber` is the old callback. But if I have to define > `grabber` before `run`, the diff will probably be very ugly: a giant > code block moved from here to there :-|. > > What do you think? If it's messy, clean it up. ;-) "The diff would be big" is a bad excuse for not doing something IMHO. However, this "if" feels like a big hack saying "I changed the API, but on second thought I'd rather have the old one again". I'm playing my usual "sorry, no time to code this myself"-card and return to doing non-awesome stuff. (Yes, I do mean both meanings of this sentence) Uli -- "For saving the Earth.. and eating cheesecake!" -- To unsubscribe, send mail to [email protected].
