stop processing key events twice on windows (#71) #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Basically what the title says.
What?
On windows
igrep
does run, but is basically unusable. When navigating through matches the cursor always moves by two lines (see #71). When opening the pattern dialog or keymap popup they close immediately. In some cases when running the program the first match is immediately opened. After closing the editor it is again opened immediately.How?
Key events seem to be sent twice on windows, the second time with a release kind. This commit ignores such release events.
The crossterm documentation says the
kind
field is only set in certain conditions. Therefore the changes only use it if those conditions are met:The field is always set if the platform is windows. Thus it is always used on windows.
On unix platform the field needs to be explicitly enabled before it can be used. I could not find any code enabling the field, therefore it is always ignored.
Should this change in the future, the
event_kind_enabled
definition needs to be updated. This has been marked by a comment.Notes
Sorry for having this commit show up multiple times in #71. I tried to get GitHub to display the commit as verified, but it just doesn't want to. I don't know what its problem is, local git can verify the commit just fine. Also, I use the same SSH key for pushing, so either GitHubs commit verification or push authentication is broken.
If this is a problem I can recreate the commit in a couple of days with my GPG key that I used last time I contributed.