fix(cli): fill content area background on wrapped input lines - #5568
Conversation
|
@qwen-code /triage |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Thanks for the PR, @lcheng321! 👋
Before we dive into the code, this needs a quick pass against the PR template. A few required sections are missing:
- Reviewer Test Plan — the most important one. Right now there's no reproduction steps, no Before/After evidence (tmux capture, screenshots, or recording), and no "Tested on" OS matrix. For a TUI rendering fix like this, a side-by-side Before/After of the wrapped input lines is exactly what reviewers need to approve.
- Risk & Scope — even for a one-line fix, note the risk (e.g. "only affects wrapped input rendering; no breaking changes").
- Linked Issues — the body says
Fixes #5562inline but should use the Linked Issues section so GitHub auto-closes it. - 中文说明 detail block — required for bilingual review.
Once the template is filled in, happy to re-run triage. 🙏
中文说明
感谢 @lcheng321 的 PR!👋
在开始代码评审之前,需要先按 PR 模板 把几个必填部分补齐:
- Reviewer Test Plan:这是最关键的一块。目前缺少复现步骤、Before/After 证据(tmux 截图、录屏或截图均可)、以及"Tested on"操作系统矩阵。对于这类 TUI 渲染修复,评审人最需要看到的就是换行输入前后效果的并排对比。
- Risk & Scope:即使只是一行改动,也请写明风险(例如"仅影响输入框换行渲染,无破坏性变更")。
- Linked Issues:正文里写了
Fixes #5562,但请放到 Linked Issues 区块,GitHub 才会自动关闭 issue。 - 中文说明 折叠块:双语评审必需。
模板补齐后,会重新跑 triage。🙏
— Qwen Code · qwen3.7-max
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ Downgraded from Approve to Comment: CI still running (22 checks pending).
— qwen3.7-max via Qwen Code /review
|
@qwen-code /triage |
|
Thanks for the PR, @lcheng321! Template looks good ✓ — all sections present, bilingual, linked to #5562. On direction: this is a straightforward rendering bug fix. User-reported in #5562 — input box background color has visible gaps on wrapped lines. Purely cosmetic, no risk of breaking anything else. Well within the project's UI polish mission. Claude Code's CHANGELOG has similar entries ("full-width background highlight" fixes), confirming this is a legitimate concern for terminal UI tools. On approach: this is about as minimal as it gets — one prop addition on an existing Moving on to code review. 🔍 中文说明感谢 @lcheng321 的 PR! 模板完整 ✓ — 所有章节齐全、双语、关联 #5562。 方向:这是一个很直接的渲染 bug 修复。用户 #5562 报告输入框换行时背景色有可见断裂。纯视觉问题,不会破坏其他功能。完全属于项目 UI 打磨的范畴。Claude Code 的 CHANGELOG 也有类似的"全宽背景高亮"修复记录,说明终端 UI 工具关注这类问题是合理的。 方案:改动极小 — 只在现有 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewThe diff is a single-line addition of
Tmux TestingTested via bundled build with the PR change applied. Before (installed v0.18.5 — bug present)ANSI escape analysis (line 12–13 of input area): No After (this PR — bundled build with fix)ANSI escape analysis (input area):
中文说明代码审查Diff 仅在
Tmux 测试通过打包构建(bundled build)应用 PR 改动进行测试。 修复前(已安装 v0.18.5): 无 修复后(本 PR): — Qwen Code · qwen3.7-max |
|
Reflection: this is a textbook minimal fix. One prop, one line, zero new abstractions. The problem is real (user-reported with screenshot), the root cause is well-understood (Ink doesn't paint background on empty cells unless My independent proposal for this bug would have been exactly what this PR does — set The ANSI escape sequence evidence is conclusive: before the fix, no One minor note: the PR's "Tested on" table has all three platforms marked Ship it. ✅ 中文说明反思:这是一个教科书式的最小修复。一个属性、一行代码、零新抽象。问题是真实的(用户带截图报告),根因理解清晰(Ink 不在容器上设置 如果让我独立提出修复方案,结果会和本 PR 完全一样 — 在内容 ANSI 转义序列证据确凿:修复前无 小提醒:PR 的"测试平台"表三个系统都标了 可以合并 ✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
🔬 Maintainer verification — local build + real-TUI A/BI built this PR from source in an isolated worktree and ran a deterministic before/after on the real How it was verified
Evidence — the wrapped continuation line (visual line 2)
So Ink's Findings
RecommendationSafe to merge — correct, low-risk, no regressions, graceful on every theme — if the project wants the composer to read as a solid theme-colored box (finding #4). Non-blocking, optional: add a small regression test and tidy the "reuse" wording in the description. 🇨🇳 中文版(完整对应)🔬 维护者验证 —— 本地构建 + 真实 TUI A/B我在独立 worktree 中从源码构建了本 PR,并对真实 验证方法
证据 —— 换行续行(可视第 2 行)
即 Ink 的 发现
建议可以合并 —— 正确、低风险、无回归、对所有主题优雅降级 —— 前提是项目希望输入框呈现为实心主题背景的盒子(见发现 #4)。非阻塞、可选:补一个小回归测试,并修正描述里"复用"的措辞。 |
…5746) The TUI paints no global background — almost everything relies on the terminal's own background. The input box (since #5568) and the user-message band flood themselves with theme.background.primary, which only looks right when the active theme's brightness matches the terminal. Forcing e.g. "Qwen Light" onto a dark terminal painted a bright input box and bright message bands fighting the dark surroundings. Add themeManager.getTerminalBackgroundType() (memoised; prefers the startup OSC 11 result, else a sync COLORFGBG/macOS heuristic) and gate those fills on it: use the theme background when it matches the terminal, otherwise stay transparent and blend in. The software cursor derives its contrast from the same effective background so it stays visible when no fill is painted.
The TUI paints no background of its own and relies on the terminal's own background. Two elements broke that and rendered as off-colour blocks that could not be made consistent across terminals and themes: - The input box (QwenLM#5568) flood-filled theme.background.primary. Even when the theme's light/dark bucket matched the terminal (the QwenLM#5746 gate), the exact colour usually differed from the terminal's real background, so the prompt rendered as a distinct block — worst over SSH/remote where brightness detection is unreliable and defaults to dark. - The user-message half-line band (QwenLM#4595) painted a subtleBandColor band behind each user message, gated on the same theme/terminal match. Because history is rendered through Ink <Static> (committed rows are never repainted) and the gate only fires when the active theme matches the terminal, the band showed on some messages but not others across a theme switch — it cannot be made consistent. Stop painting both so the input area and user messages blend into the terminal background everywhere. User messages fall back to marginTop=1 for separation. The software cursor now derives its contrast from the terminal's detected brightness (getEffectiveTerminalBackground) so it stays visible with no fill painted. Fixes QwenLM#5771. Generated with AI Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
The TUI paints no background of its own and relies on the terminal's own background. Two elements broke that and rendered as off-colour blocks that could not be made consistent across terminals and themes: - The input box (QwenLM#5568) flood-filled theme.background.primary. Even when the theme's light/dark bucket matched the terminal (the QwenLM#5746 gate), the exact colour usually differed from the terminal's real background, so the prompt rendered as a distinct block — worst over SSH/remote where brightness detection is unreliable and defaults to dark. - The user-message half-line band (QwenLM#4595) painted a subtleBandColor band behind each user message, gated on the same theme/terminal match. Because history is rendered through Ink <Static> (committed rows are never repainted) and the gate only fires when the active theme matches the terminal, the band showed on some messages but not others across a theme switch — it cannot be made consistent. Stop painting both so the input area and user messages blend into the terminal background everywhere. User messages fall back to marginTop=1 for separation. The software cursor now derives its contrast from the terminal's detected brightness (getEffectiveTerminalBackground) so it stays visible with no fill painted. Also remove the band's now-unused helpers — subtleBandColor and supportsTrueColor (added by QwenLM#4595) and the dead UserMessageProps.width prop. Fixes QwenLM#5771. Generated with AI Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
The TUI paints no background of its own and relies on the terminal's own background. Two elements broke that and rendered as off-colour blocks that could not be made consistent across terminals and themes: - The input box (#5568) flood-filled theme.background.primary. Even when the theme's light/dark bucket matched the terminal (the #5746 gate), the exact colour usually differed from the terminal's real background, so the prompt rendered as a distinct block — worst over SSH/remote where brightness detection is unreliable and defaults to dark. - The user-message half-line band (#4595) painted a subtleBandColor band behind each user message, gated on the same theme/terminal match. Because history is rendered through Ink <Static> (committed rows are never repainted) and the gate only fires when the active theme matches the terminal, the band showed on some messages but not others across a theme switch — it cannot be made consistent. Stop painting both so the input area and user messages blend into the terminal background everywhere. User messages fall back to marginTop=1 for separation. The software cursor now derives its contrast from the terminal's detected brightness (getEffectiveTerminalBackground) so it stays visible with no fill painted. Also remove the band's now-unused helpers — subtleBandColor and supportsTrueColor (added by #4595) and the dead UserMessageProps.width prop. Fixes #5771. Generated with AI Co-authored-by: 秦奇 <gary.gq@alibaba-inc.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
What this PR does
Adds
backgroundColor={theme.background.primary}to the input content container (<Box flexGrow={1} flexDirection="column">) inBaseTextInput.tsx, so the whole input area paints one continuous background — including the trailing empty cells that appear on wrapped or multi-line input.Why it's needed
Ink only paints the terminal cells that actually contain text. The content container
<Box>had nobackgroundColor, so the trailing empty cells on any wrapped/multi-line input fell through to the terminal's default background, leaving a visible gap in the input box. Setting abackgroundColormakes Ink flood-fill the box's entire computed layout area before drawing children, covering all empty cells regardless of wrap mode. Reported in #5562.Reviewer Test Plan
How to verify
npm run dev, or a builtqwen).Expected (after this PR): the background color fills the entire input area continuously, with no gaps on wrapped/extra lines. Before: trailing empty cells on wrapped lines show the terminal's default background, breaking the box visually.
Evidence (Before & After)
Before — from #5562 (red arrows mark the discontinuity):
After — author capture pending; expected result is the gap-free, continuously-filled input background described above. (Reformatted to the template by a maintainer — I did not run the TUI locally, so I'm not attaching a fabricated "after".)
Tested on
Environment (optional)
N/A — a single rendering-prop change with no runtime/sandbox specifics.
Risk & Scope
backgroundColorreuses the existingtheme.background.primarytoken (already used across components likePermissionsDialog,StatsDialog,PrepareLabel), so it tracks the active theme rather than hard-coding a color.Linked Issues
Fixes #5562
中文说明
这个 PR 做了什么
在
BaseTextInput.tsx的输入内容容器(<Box flexGrow={1} flexDirection="column">)上增加backgroundColor={theme.background.primary},使整个输入区域绘制为连续的背景色 —— 包括换行或多行输入时出现的行尾空白单元格。为什么需要它
Ink 只会绘制真正包含文字的终端单元格。内容容器
<Box>此前没有设置backgroundColor,因此换行/多行输入的行尾空白单元格会"漏"到终端默认背景,导致输入框出现可见的断裂。设置backgroundColor后,Ink 会在绘制子元素之前用该背景色铺满整个盒子的布局区域,无论是否换行都能覆盖所有空白单元格。问题见 #5562。Reviewer 验证步骤
如何验证
npm run dev,或已构建的qwen)。期望(本 PR 之后):背景色连续铺满整个输入区域,换行/多出来的行上没有空洞。修复前:换行行的行尾空白单元格显示为终端默认背景,视觉上割裂。
证据(前 & 后)
修复前 —— 来自 #5562(红色箭头标出断裂处):
修复后 —— 作者截图待补;预期是上文所述连续、无空洞的输入框背景。(描述由维护者按模板重排 —— 我没有在本地实跑 TUI,因此不附伪造的"修复后"截图。)
测试平台
运行环境(可选)
N/A —— 仅一处渲染属性改动,无运行时/沙箱相关。
风险与范围
backgroundColor复用既有的theme.background.primary主题令牌(PermissionsDialog、StatsDialog、PrepareLabel等组件均已使用),因此跟随当前主题而非硬编码颜色。关联 Issue
Fixes #5562