chevalric/keymaster-sequence — pull request #3 by tedkulp (2013-02-20 04:19:09+00:00)
Title: Scope doesn't reset right away

Using the gmail shortcuts, imagine you have two sequences: [g, i] goes to Inbox, and [g, a] goes All Mail. Now if you type within a second: [g, i, a], you'll end up in All Mail. When instead, you should still be in Inbox, and the keyboard shortcut for "a" (whatever it is) should take effect instead. It's because we're still waiting on that 1 second timeout that went into effect when g was typed to expire.

This fixes that by wrapping the original method right as the final key in the sequence is called, resetting the scope back to the original, and then calling the original passed in method as before. The timeout does eventually fire, though I don't see it being too big of a deal. I was tempted to try and figure out a way to clear them, but didn't get that far yet. Maybe if I'm bored tomorrow.

My tests show it working a lot better. I'm still seeing some weirdness if you type a bunch of commands too quickly, or hit something where a sequence and a regular shortcut overlap ([g, i] vs just i), but I haven't quite figured out where that is coming from yet. They might just be Keymaster related -- I really haven't looked at that code at all yet.

Let me know if you see any issues. Thanks!