9143Re: Does MacVim drop characters?
- Oct 1, 2008Hi Björn,
On 2008-10-02, at 01:16, björn wrote:
> The only thing I can think of right now that may work is to drop
> keyboard input if it comes from a repeated press (i.e. holding down
> "j"), but not when it represent a single key press. I'm going to try
> that now and see how it goes.
That sounds like you'd be implementing that behavior on the back-end.
How would that handle the case of repeating a key, and then pressing
I think of keyboard repeat as a "non-deterministic" thing; that is, it
requires feedback (audio/visual) to be useful. So any time the screen
gets out of sync with keyboard repeat is a bad thing. I'd recommend
having the back-end process check in with the front-end when it's done
processing its command queue, and then have the front-end implement
keyboard repeat internally.
The back-end would need to send back the last key it processed,
otherwise there could be a race condition.
1. Front-end gets key presses, "hi.<esc>j" ('j' is held down by the
user). Saves time of last key press.
2. Front-end posts those keys to the back-end ('j' only once)
3. Back-end processes queue, sends back EmptiedInputQueueEndingWith('j')
4. Front-end gets message, sees that 'j' is still held down. If time
of last key press < repeat interval, then start a timer waiting until
5. Now it's past the key repeat interval. If the key is still down,
send one 'j' to the back-end, sets "repeating" status.
6. Back-end processes key, sends back EmptiedInputQueueEndingWith
7. Front-end gets message. If time of last key message < key repeat
rate, start a timer. Loop to 5.
It's fairly convoluted, but it seems like the most desirable behavior
to me. You'd have to be careful doing repeat with modifiers, too. What
do you think?
Key repeat rates (in ticks, 1/60 sec):
[[NSUserDefaults standardUserDefaults] integerForKey:@"KeyRepeat"]
Is an event a key repeat? -[NSEvent isARepeat]
You received this message from the "vim_mac" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>