charmbracelet / charmbracelet/bubbletea

bug: loss of input on ReleaseTerminal / Bubbletea shutdown

Open
#616 9 comments 9 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
44.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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:

- [x] invert control of the input reader function, i.e. this PR: https://github.com/charmbracelet/bubbletea/pull/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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.