Skip to content

gitnr search view reacts to both Press and Release events #3

Description

@supleed2

In fn handle_key_events (here), the event.kind is not checked with keyboard input.

I think this event is created when pressing and releasing a key, so every key is reacted to twice. Trying to select using enter selects and then unselects, or using arrow keys moves 2 items at a time.

This is on Windows, but looking at the crossterm docs, the event kind needs to be opted-in for unix systems so it might not happen for you.

Activity

  1. realfresh commented on Sep 12, 2023

    @realfresh
    Contributor

    Hey, thanks for the heads-up and providing the relevant docs.

    Didn't notice that at all. Thankfully, I think the fix was quite simple (7dffa5b).

    I also enabled event.kind for Unix systems as well, so things are consistent across platforms.

    The new release v0.1.1 has that fix.

    Let me know if it works fine, I don't use Windows and as such can't test it out easily.

  2. supleed2 commented on Sep 12, 2023

    @supleed2
    Author

    Hey, thanks for reacting so quickly. The new version actually doesn't work now hah. Screenshot below:

    image

    I think you might need to gate the push and pop of KeyboardEnhancementFlags, maybe behind cfg(not(windows)), I'm not sure on the syntax. But the rest of the commit looks correct. This is probably because, as the crossterm docs say, it's always enabled for Windows and the enhancement flags don't exist.

    PS: would you consider publishing to crates.io? It would allow for installation via cargo-binstall too, since it pulls metadata from there to then locate the GitHub release url.

  3. realfresh commented on Sep 14, 2023

    @realfresh
    Contributor

    My bad mate...lol. Thanks for showing the error and pointing me in the right direction.

    Managed to fix that issue and tested it in my Windows VM. Also managed to fix a few other issues too.

    Release v0.1.3 is available now.

    I've also set up the GH action to publish the crate, so it's available on crates.io now. I've also configured it to work with cargo-binstall as well. Check out the README for more info on the new install methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions