Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Button gets pressed on mouse hover with crossterm #767

Open
nxsaken opened this issue Nov 21, 2023 · 4 comments
Open

[BUG] Button gets pressed on mouse hover with crossterm #767

nxsaken opened this issue Nov 21, 2023 · 4 comments
Labels

Comments

@nxsaken
Copy link

nxsaken commented Nov 21, 2023

Describe the bug
Hovering over a button presses it when using the crossterm backend. Termion has the correct behavior.

To Reproduce

  1. cursive = { version = "0.20.0", default-features = false, features = ["crossterm-backend"] }

  2. Use the example code:

use cursive::views::{Dialog, TextView};

fn main() {
    // Creates the cursive root - required for every application.
    let mut siv = cursive::default();

    // Creates a dialog with a single "Quit" button
    siv.add_layer(Dialog::around(TextView::new("Hello Dialog!"))
                         .title("Cursive")
                         .button("Quit", |s| s.quit()));

    // Starts the event loop.
    siv.run();
}
  1. Touch the quit button with the mouse cursor.

Expected behavior
Nothing happens unless I left-click.

Environment

  • macOS Sonoma 14.0, M1 pro
  • Backend: crossterm
  • Current locale:
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
  • Cursive version: 0.20
@nxsaken nxsaken added the bug label Nov 21, 2023
@gyscos
Copy link
Owner

gyscos commented Feb 6, 2024

Hi, and thanks for the report!

I'm unable to reproduce the issue so far, running on a M1 pro laptop on Sonoma 14.2.1.
What version of crossterm is in Cargo.lock?

@nxsaken
Copy link
Author

nxsaken commented Feb 6, 2024

Hi! 0.25.0

@gyscos
Copy link
Owner

gyscos commented Feb 6, 2024

I still cannot reproduce it, either with the default terminal app, or with alacritty.

Does the issue still exist when running from this git main branch? (It should use crossterm 0.27.0).

Note also that cursive expects a utf-8 locale. You could try setting for example export LANG=en_US.UTF-8 (or some other locale of your choice) to see if that makes a difference, though I don't think it should in this case.

@nxsaken
Copy link
Author

nxsaken commented Feb 6, 2024

Huh, I ran the app from Terminal, and it worked as expected. The problem only happens if I run the app from the terminal in my IDE (CLion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants