Comments (8)
Hey, I'm not the maintainer but I'm the one who introduced this change in my PR (#120). First, I'm very sorry I broke your app.
I disabled windows.ENABLE_VIRTUAL_TERMINAL_INPUT
out of necessity because it being disabled is important to support running multiple bubbletea
programs in a single Go program on Windows Terminal. However I totally missed that this also disables special keys such as arrow keys. Ultimately, working specials keys is way more important that running multiple programs so I think we should re-enable windows.ENABLE_VIRTUAL_TERMINAL_INPUT
as you suggested.
However, as far as I know, mouse was never supported by bubbletea
on Windows. Am I wrong?
Some background: bubbletea
currently reads bytes from stdin
and decodes special byte sequences as special keys. This works on Windows, macOS and Linux. However, in order to be able to stop an ongoing read if the bubbletea
program terminates, I had to implement a mechanism where we ask the OS if something is available and start the read only if something is there to read. However, on windows stdin
can contain a lot of different events and some of them cannot be read as bytes. By carefully setting the terminal mode I can avoid such unreadable events. With windows.ENABLE_VIRTUAL_TERMINAL_INPUT
some of these events are re-introduced (may key release events), so Windows says "something is available on stdin
" and when I try to read it as bytes, nothing is there and I'm stuck in an uncancelable read.
There are also some good news:
- The unreable events from
windows.ENABLE_VIRTUAL_TERMINAL_INPUT
happen only on Windows Terminal, in the oldconhost
withPowershell
orcmd
this is not an issue - I'm already working on reading events as events instead of byte-sequences such that no event is unreadable. This also enables windows size change events and mouse events.
from bubbletea.
No need to apologize, I appreciate all the hard work you must've put into that PR. My mistake, I didn't check to see if the mouse was working on previous versions as I was not using it in my app. I just ran through the examples to test my change and noticed that the mouse does work with ENABLE_VIRTUAL_TERMINAL_INPUT
enabled, so I guess that's a secondary benefit to enabling it. Thanks for taking the time to explain that, it definitely makes sense to me now.
from bubbletea.
@aschey, thanks so much for reporting this regression. It totally slipped past all of us.
We’ll have a patch for this in shortly, enabling the flag as you and Erik suggest. It’s really nice to hear that it will enable the mouse as well.
As Erik mentions, reading further input in a Go application after a Bubble Tea program has existed will be unreliable, as it was previously. This, of course, will be fixed once Erik’s Windows input reader is in.
from bubbletea.
@aschey I you have working mouse events on the earlier bubbletea
version it would be very interesting to know your Windows version and which Terminal you use. We were under the impression that mouse events were not emitted at all on Windows.
from bubbletea.
Sounds good, thanks both! @erikgeiser Here's my system info:
Windows build: 19043.1237
Windows Terminal version: 1.10.2383.0
Powershell 7 version: 7.1.4
Old Windows-only Powershell version: 5.1.19041.1237
I tried on Windows Terminal and the built-in Powershell host and it seems to work with every combination of these, with both old and new Powershell. Here's a quick demo I recorded on the lastest master branch with no changes except the one line I posted earlier. Every input seems to work - mouse movement, wheel up, wheel down, left click, right click, middle click, and release.
from bubbletea.
Ok! This has been fixed via #138, which was just merged into master
. It'll be available in the next release shortly.
Thanks @aschey (and @erikgeiser) for all the insight and help here. We've temporarily lost cancelReader
functionality but have gained mouse support on Windows across the board.
from bubbletea.
Alright, this is now available in v0.17.0
.
from bubbletea.
Thanks, appreciate the quick turnaround!
from bubbletea.
Related Issues (20)
- Viewport component fails to scroll after HTTP request HOT 1
- External process input errors when using `cmd.exe` HOT 3
- Application deadlock when initial model's init panics HOT 1
- `[ctrl+enter]` Support HOT 5
- text rendering incorrectly using serial data HOT 7
- Stopwatch example does not run correctly on Windows HOT 1
- How to use bubbletea and gum in existing cli which was built using cobra cli framework?
- kill the process but the mouse code still output in the console HOT 3
- A feature to avoid IDE extensions and build them in cli HOT 2
- Unmanaged Output Truncation (e.g. `tea.Println`) HOT 1
- Show example GIFs on all examples HOT 1
- The input isn't verified before using epoll on it HOT 3
- go version in go.mod is outdated HOT 2
- does Update() get called even when there are no keys being pressed?
- Can't write japanese characters in inputfield HOT 2
- Exit with error message to stderr and non-zero status code
- Async Clipboard
- Automatic command chaining: Cmd -> Cmd -> Msg HOT 1
- Allow WindowSizeMsg to be sent on sub-model Init HOT 5
- Progress bar behaving strangely
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bubbletea.