fix: grow TUI composer for wrapped input#3278
Merged
Merged
Conversation
Use textarea dynamic height so manual newlines and soft-wrapped pasted text expand the composer without hiding earlier lines. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
SivanCola
approved these changes
Jun 5, 2026
SivanCola
left a comment
Collaborator
There was a problem hiding this comment.
Approved. This is a well-scoped TUI fix. The PR switches the chat composer to the textarea's dynamic-height support so manual newlines and soft-wrapped pasted text expand the composer without scrolling away the first line.
Why this fits the implementation:
- The bottom rail already sizes the transcript from
m.input.Height(), so letting the textarea own visual-row height composes cleanly with the existing viewport layout. - The removed manual
SetHeight(1)calls are covered by textareaReset()recalculating dynamic height, whileSetValueandSetWidthalso recalculate height for history/rewind and resize paths.
Cache/security review:
- No provider-visible prompt, tool schema, request serialization, compaction, dependency, network, file, command execution, or secret-handling changes.
Verified:
go test ./internal/clipassedgo test ./internal/cli -run 'Test(ManualNewline|SoftWrapped|PasteMsgFolds|TranscriptViewportSizing)' -count=1 -vpassedgit diff --check origin/main-v2...HEADpassed
Collaborator
|
Related follow-up: #3054 also touches the CLI TUI bottom rail height budget for status-line wrapping. I checked the combined order locally: this PR applies cleanly first, while #3054 needs to rebase on top of this dynamic-composer shape and fix wrapped status/working-line row accounting before it can land. |
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.
摘要
修复 chat TUI 输入框在多行输入场景下不会正确动态增高的问题。
本次修复覆盖两个相关现象:
Ctrl+J手工换行时,输入框虽然插入了新行,但第一行可能被顶出可视区域。改动内容
configureChatTextarea。SetHeight(1)。Ctrl+JAlt+EnterShift+EntergrowInputToFit不再手动覆盖 textarea 高度,避免和组件内部滚动状态冲突。背景与原因
之前的实现通过手动统计
\n来调整输入框高度:这个方式有两个问题:
会先按一行高度调整内部滚动位置,随后外层再手动增高,导致第一行被滚出可视区域。
改为使用 textarea 自带的 DynamicHeight 后,高度计算由组件按 visual lines
完成,可以同时覆盖手工换行和软换行。
回归测试
新增测试覆盖:
测试计划
eedVisibleComposerRows|TestSoftWrappedInputGrowsComposerAndShrinksTranscript'
tLine|TestManualNewlineCanExceedVisibleComposerRows|TestSoftWrappedInputGrowsComposerAndShrinksTranscript|T
estPasteMsgFoldsBeforeTextareaConsumesNewlines|TestModalPanelsHideComposerBox|TestMCPManagerHidesComposerBo
x|Test.*Completion|Test.*Paste|Test.*Input|Test.*Viewport|Test.*Render'