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: loss of input on ReleaseTerminal / Bubbletea shutdown #616

Open
1 of 3 tasks
knz opened this issue Nov 30, 2022 · 8 comments
Open
1 of 3 tasks

bug: loss of input on ReleaseTerminal / Bubbletea shutdown #616

knz opened this issue Nov 30, 2022 · 8 comments

Comments

@knz
Copy link
Contributor

knz commented Nov 30, 2022

It is not currently possible to integrate Bubbletea-based programs in scripts or unit tests that buffer terminal input
across multiple runs of the Bubbletea event loop.

The specifics are explained here: https://dr-knz.net/bubbletea-control-inversion.html

In summary, the input reader function is "greedy" but drops/forgets input event messages during ReleaseTerminal(). This is where the input is lost.

The text linked above outlines a solution:

  • invert control of the input reader function, i.e. this PR: fix(key): invert the control loop #569
  • synchronise the reading from the external input with Update calls.
  • for the benefit of programs (like Bubbline) that need to share control of the terminal, introduce a new API to suspend the Bubbletea event loop.
@knz
Copy link
Contributor Author

knz commented Nov 30, 2022

cc @muesli @meowgorithm

@chabad360
Copy link

Is there any update on this? This seems to happen pretty consistently when mouse input gets involved.

@knz
Copy link
Contributor Author

knz commented Mar 20, 2023

@chabad360 can you say more? What are the symptoms?

@chabad360
Copy link

chabad360 commented Mar 20, 2023

After clicking around for a bit (an easy way to speed this up is to click outside the terminal), the entire system stops receiving input but does still respond to other things like resizing the window. If I force kill the program with pkill, the terminal no longer accepts input.

Now that I'm rereading the issue, it seems different, but still related.

@knz
Copy link
Contributor Author

knz commented Mar 20, 2023

Thanks. I think you are experiencing the symptoms of a different problem, but i believe it could also improve with this change #569

@knz
Copy link
Contributor Author

knz commented Mar 20, 2023

And also this change #570

@chabad360
Copy link

hmm, go mod replaceing that branch in doesn't seem to help...

@malko
Copy link

malko commented Apr 15, 2024

Is there any plan to address this issue in a near future ?
Side note great and interesting explanation of @knz in the provided link.

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

No branches or pull requests

3 participants