Git Product home page Git Product logo

Comments (7)

erikgeiser avatar erikgeiser commented on July 17, 2024 1

Windows supports mouse events which can be read (alongside all other input events) with ReadConsoleInput. However, this means that the Windows input event parsing logic (which would then be based on INPUT_RECORD structs) would have to be decoupled from the Unix logic.

This is quite a bit of work but if the Windows implementation is rewritten to read INPUT_RECORDs, it can also likely use PeekConsoleInput which can replace the WaitForMultipleObjects mechanism introduced in #120 and thereby also solve #24 for the Windows Terminal where the mechanism from #120 does not work reliably.

By the way, a INPUT_RECORD can also be a WINDOW_BUFFER_SIZE_EVENT which sounds like a good replacement for SIGWINCH on Windows.

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

If you’re using the Windows Linux Subsystem in Windows Terminal the mouse will work (you can enter the subsystem with wsl).

Beyond that, I'm not entirely sure if Windows Terminal supports the mouse outside of WSL so we'll need to do some research here. Currently, we're only processing X10/X11 mouse events (which all unix-like systems support).

from bubbletea.

irevenko avatar irevenko commented on July 17, 2024

But you did write support for usual win command line

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

@irevenko If it's possible to add native mouse support in Windows we'll definitely do it. In the meantime, you're welcome to submit a PR which adds the functionality.

from bubbletea.

jon4hz avatar jon4hz commented on July 17, 2024

If I remember correctly, gocui has implemented mouse support for Linux and for Windows. Maybe you can take a look at how they did it. Unfortunately I can't do a PR as this is beyond my skill level

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

Bubble Tea now supports mouse events in Windows in master. This functionality will be available in the next release.

As a technical note, we're only processing X10 mouse events, which are fairly basic across the board. It's possible to ReadConsoleInput (mentioned by @erikgeiser above) to gain access to higher fidelity mouse events on Windows.

from bubbletea.

meowgorithm avatar meowgorithm commented on July 17, 2024

This is now available in v0.17.0.

from bubbletea.

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.