neovide: Missing input events
Description
Rapidly inputting key strokes often results in missing strokes.
Expected behaviour
All key strokes, be it by hand or macros, should get to the text editor.
Steps to reproduce
Either mash your keyboard or use external macro software (such as AutoHotKey).
For example, mashing ‘aoeu’ together results in:
uuuu
In gvim, this would result in:
aoeuaoeuouaeaoeu
Environment
Windows 10 build 1909, using AutoHotKey and a mecanical keyboard with N-Key rollover support.
Plausible cause
After a quick look through the code base, I noticed that, in the ui_loop
function in src/window.rs
, the variables keycode
and keytext
are set to the last Event::KeyDown
or Event::TextInput
of the event_pump
iterator, ignoring the first such events of the loop.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (5 by maintainers)
@roflolilolmao @pbartyik Does this fix your issue? https://github.com/Kethku/neovide/pull/322
On #314, by hitting several keys at once or using a macro, I get all strokes. However, space and some shifted keys are duplicated or otherwise output weirdly.
I hit all my keys once, without modifiers, then shifted, in both my main layout and qwerty. Here is the output:
We can clearly see that the spaces are duplicated and the shifted keys behave weirdly. I don’t know how inputs should be handled with SDL2 but I suspect the
Event::KeyDown
andEvent::TextInput
events both contain the information about the key strokes and this is the reason for this behaviour. The events are later deduplicated byproduce_neovim_keybinding_string
called inwindow.handle_keyboard_input
. This means the linekeytexts.push((keycode, None));
in theEvent::KeyDown
arm will not have the input deduplicated if a correspondingEvent::TextInput
exists.Since this is not a trivial issue and touches the very core of the input handling, which is the most important part of any text editor, I think we should approach this very carefully. @Kethku what’s your opinion on the matter?
My initial issue can be reproduced by setting the refresh rate to something low, for example
:let g:neovide_refresh_rate=1
. You will be able to type several strokes a second and see most of them fail to get there.Thanks
This might be bad wording on my end: I don’t actually encounter it that much by regular typing but my AutoHotKey macros work about 10% of the time. Since they are important to my workflow, I’m not really sure I can switch to neovide just yet, which is a shame because it looks really good.