fix(tui): prevent prompt textarea collapsing to zero width in small windows#15073
fix(tui): prevent prompt textarea collapsing to zero width in small windows#15073Geralt4 wants to merge 4 commits intoanomalyco:devfrom
Conversation
Fixes anomalyco#4332 When the leader key was active, the textarea text color was set to theme.textMuted, causing visibility issues when the terminal window is small. This change ensures the input field text always uses theme.text for consistent visibility regardless of window size or leader key state.
…all windows Add overflow=hidden to the prompt padding box and minWidth=1 to the textarea so that when the terminal is very narrow the accumulated padding (9 chars across the border + two box levels) cannot reduce the textarea to zero width, which made all typed text invisible. Closes anomalyco#4332
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the prompt textarea would collapse to zero width in narrow terminal windows, making typed text invisible. The root cause was accumulated padding (9 columns total) from nested boxes without a width floor on the textarea. The fix adds overflow="hidden" to the padding container and minWidth={1} to the textarea to ensure text remains visible at any terminal size.
Changes:
- Add
overflow="hidden"andminWidth={1}to prevent textarea collapse in narrow terminals - Remove conditional textColor based on leader key state (appears unintentional)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| textColor={theme.text} | ||
| focusedTextColor={theme.text} |
There was a problem hiding this comment.
The textColor and focusedTextColor changes remove the visual feedback when the leader key is active. Previously, these colors would change to theme.textMuted when keybind.leader was true, consistent with how the model name text changes color on line 1007. This appears to be an unintended change that's unrelated to the width fix. Consider restoring the conditional color logic: textColor={keybind.leader ? theme.textMuted : theme.text} and focusedTextColor={keybind.leader ? theme.textMuted : theme.text} to maintain consistent leader key visual feedback throughout the prompt UI.
| textColor={theme.text} | |
| focusedTextColor={theme.text} | |
| textColor={keybind.leader ? theme.textMuted : theme.text} | |
| focusedTextColor={keybind.leader ? theme.textMuted : theme.text} |
| textColor={theme.text} | ||
| focusedTextColor={theme.text} |
There was a problem hiding this comment.
The PR description states this is a "single file, 2 lines" fix for the width issue, but the changes actually span 4 lines including textColor modifications that aren't mentioned in the description. The textColor changes on lines 824-825 remove the conditional behavior based on keybind.leader state, which appears to be an unrelated change that should either be mentioned in the PR description or reverted.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
5868dac to
2869922
Compare
Issue for this PR
Closes #4332
Type of change
What does this PR do?
Fixes the bug where typing in the input field produces invisible text when the terminal window is narrowed.
The prompt layout stacks padding without a width floor:
paddingLeft={2}+paddingRight={2}= 4 colspaddingLeft={2}+paddingRight={2}= 4 colsWhen the terminal is narrower than ~9 columns, the textarea receives zero available width from the flexbox engine. Because there was no
minWidthon the textarea, it collapsed silently and rendered nothing.Changes:
overflow="hidden"to the prompt padding boxminWidth={1}to the<textarea>componentHow did you verify your code works?
Tested locally by narrowing the terminal window to minimum width (around 20 columns) on macOS and typing in the input field. Text remained visible throughout.
Screenshots / recordings
N/A - this is a layout fix that prevents text from becoming invisible; the expected behavior is simply that typed text should always be visible.
Checklist