Git Product home page Git Product logo

Comments (6)

Adham-A avatar Adham-A commented on June 26, 2024 1

On Linux

  • Scrolling fires the "Up" & "Down" events, same as using those buttons on the keyboard.

On Windows

  • No events are fired, but there is supposed to be.

Investigations :

I tried getting Mouse Events instead of key events inside the project with no luck, I then tried in an empty project with only termimad and I didn't succeed either. I then directly tried with crossterm and it worked, firing ScrollDown & ScrollUp

After some investigation you have to :

   // Have to do this part because of crossterm
    let mut stdout = io::stdout();
    execute!(
        stdout,
        EnableMouseCapture, // termimad::crossterm::event::EnableMouseCapture
    )?;
    // Have to do this part because of crossterm`

And then match the events :

#[cfg(windows)]
Event::Mouse(mouse_event) => {
    let key_code =
    match mouse_event.kind {
        MouseEventKind::ScrollDown => {KeyCode::Down}
        MouseEventKind::ScrollUp => {KeyCode::Up}
        _ => {KeyCode::Null}
    };
    action = keybindings.get(KeyEvent::new(key_code,KeyModifiers::NONE));
}
#[cfg(not(windows))]
_ => {}

If this is going to be merged :

I created an action using Down and Up to try to stay coherent to the rest.
And I will welcome some feedback to have something cleaner especially regarding the crossterm part with EnableMouseCapture.

from bacon.

Canop avatar Canop commented on June 26, 2024

vscode ? Is that issue related to bacon ?

If it is, then yes, you should be able to use the mouse wheel to scroll the report in bacon.

from bacon.

Adham-A avatar Adham-A commented on June 26, 2024

I'm on Windows, and I tried in Git Bash, CMD and powershell and I still have the same issue outside of vscode this time

from bacon.

Canop avatar Canop commented on June 26, 2024

Thanks for the investigation. I should have rememembered this myself as I had the problem before in broot.

Regarding your code, I'll comment on the PR

from bacon.

Canop avatar Canop commented on June 26, 2024

Now fixed in 2.13.0

from bacon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.