Skip to content

Double click on windows #1

@xiaolong-y

Description

@xiaolong-y

This issue is caused by a bug in how the eq tool handles keyboard events on Windows, specifically related to the distinction between "key press" and "key release" events.

The Technical Reason

The eq tool is likely built using a Rust library called crossterm (or a similar terminal handling library) to capture your input.

  • On Windows: The terminal reports two distinct events for every keystroke: one when you push the key down (KeyEventKind::Pressed) and another when you let go (KeyEventKind::Released).
  • On macOS/Linux: The terminal behavior often defaults to sending only the processed character or is handled differently by the library, so the "release" event is either not sent or not interpreted as a new input.

The developer of eq likely wrote code that says "if a key event occurs, input that character," without checking which kind of event it is. As a result, on Windows, the tool sees the "press" and inputs the character, then sees the "release" and inputs it again.

How to Fix It

Since this is a code-level bug, you cannot fix it by changing settings on your computer. You should report this to the developer so they can patch it.

  1. Go to the [Issues page of the xiaolong-y/eq repository](https://www.google.com/search?q=https://github.com/xiaolong-y/eq/issues).
  2. Click New Issue.
    Fix:

    Issue: Double input on Windows (Crossterm KeyEventKind)
    Description: On Windows, every key press is registered twice. This is likely because the event loop handles crossterm::event::Event::Key without checking if the kind is KeyEventKind::Pressed.
    Suggested Fix: In your event handling loop, ignore events where kind != KeyEventKind::Pressed.

    if key_event.kind == KeyEventKind::Pressed {
        // handle input
    }

... [crossterm Crate in Rust](https://www.youtube.com/watch?v=O2DpsTsHWek) ...

The video above provides a tutorial on the crossterm library used by tools like eq, explaining how event handling works and why distinguishing between different key event types is necessary for cross-platform compatibility.

http://googleusercontent.com/youtube_content/0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions