fix: remove CSIuReader from tea.WithInput — breaks terminal raw mode#538
Merged
asheshgoplani merged 1 commit intoasheshgoplani:mainfrom Apr 9, 2026
Merged
Conversation
3289966 to
5908bfe
Compare
tea.WithInput(io.Reader) replaces Bubble Tea's stdin with a plain io.Reader, stripping the *os.File interface. Bubble Tea needs the file descriptor to set raw terminal mode. Without it, the terminal stays in cooked mode: escape sequences are processed by the terminal driver instead of reaching the app, causing arrow keys and all CSI sequences to appear as raw text. The existing DisableKittyKeyboard/RestoreKittyKeyboard escape sequences already handle Kitty protocol terminals correctly. Remove the CSIuReader wrapper entirely — it cannot work at the io.Reader level. Also fix CSIuReader's terminator set to use the standard CSI final byte range (0x40-0x7E) instead of a hardcoded subset, so the code is correct if reused elsewhere (e.g., as a tea.KeyMsg translator in Update()). Reverts the one-line change from asheshgoplani#535.
5908bfe to
f816943
Compare
4 tasks
4 tasks
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tea.WithInput(ui.NewCSIuReader(os.Stdin))(added in #535) wraps stdin with a plainio.Reader, stripping the*os.Fileinterface. Bubble Tea needs the file descriptor to set raw terminal mode. Without it, the terminal stays in cooked mode: escape sequences are processed by the terminal driver instead of reaching the app. Arrow keys, mouse events, and all CSI sequences appear as raw text.Fix: remove the
tea.WithInput(CSIuReader)line entirely. The existingDisableKittyKeyboard/RestoreKittyKeyboardescape sequences already handle Kitty protocol terminals. The CSIuReader approach cannot work at theio.Readerlevel.Also fixes the CSIuReader's internal terminator set to use the standard CSI final byte range (
0x40-0x7E) instead of a hardcoded subset that missed SGR mouse terminators (M/m). This makes the code correct if reused as atea.KeyMsgtranslator inUpdate().Reverts the one-line change from #535.
Fixes #539
Test plan
TestCSIuReaderPassesSGRMouseEvents— regression test for the terminator fix