Repository navigation
[6251] 修复 Windows 长表格发起 AI 对话后输入框光标所在行被遮盖 - #4809
Merged
PinkMagicFly merged 1 commit intoNov 24, 2026
Merged
Conversation
PinkMagicFly
force-pushed
the
pigmagicfly/6251/windows-chat-input-cursor-obscured
branch
2 times, most recently
from
November 24, 2026 04:14
13932e6 to
3103247
Compare
PinkMagicFly
force-pushed
the
pigmagicfly/6251/windows-chat-input-cursor-obscured
branch
from
November 24, 2026 05:43
3103247 to
4d2840f
Compare
PinkMagicFly
deleted the
pigmagicfly/6251/windows-chat-input-cursor-obscured
branch
November 24, 2026 06:27
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.
背景
Windows 环境下选中长表格、通过 AI 操作栏选择「对话」并自动打开右侧 AI 侧边栏后,输入框中光标所在行被遮盖而不可见。
根因
不是滚动值的问题,而是输入区整块溢出面板、被面板底边裁掉。
长表格引用块把输入框升到 5 倍档(382px),而欢迎页顶部留白
topSpacer_是固定「面板高 × 2/7」、输入框又是setFixedHeight—— 两者都不可压缩,总高超过面板高度(dock 侧边栏常见 502px)时布局溢出:于是「按钮行整行不见、表格最后一行被切断、光标所在行落在面板外」。此时滚动条已经在
maximum,光标确实位于编辑器视口底部,但那个底部本身在面板外,所以「滚到底 / 按光标几何滚动 /cursor_visible」都无法让光标行可见——这也解释了此前几版只改滚动为什么不生效。修复(只动布局)
新增
ChatConversationPanel::updateInputAreaFit(),保证输入区(输入框 + 按钮行 + 免责声明)始终完整落在面板内:两件事必须同时做:只收缩留白会在面板极矮时仍溢出,只封顶则留白继续把输入区顶出面板。
接入点:
resizeEvent(统一入口)、adjust_input_height(升档后同步收缩)、eventFilter的 Enter 预升档(同样受封顶约束)、enterConversationMode(消息区占位后按对话模式重新封顶)。不改动
revealInputCursor的滚动行为、composeAiInputBody/chat-tab-set-input-body!的 go-end 语义;不裁剪引用块、不隐藏按钮行、不强制显示滚动条。可测试逻辑
抽出两个不依赖真实窗口的纯函数并在
qt_chat_tab_widget_test.cpp覆盖:input_frame_height_cap:面板够高不限制、面板矮时按「面板高 − 输入区固定高 − 上方保留高」封顶、面板极矮或尚未布局时不低于基准档;input_area_spacer_offset:留白按剩余空间收缩、空间不足压到 0、设计留白为负时不产生负值。验证
xmake b qt_chat_tab_widget_test+ 运行:98 passed, 0 failed(新增 6 条布局用例)xmake b stem:构建通过;gf fmt --changed-since=<base>:格式化幂等Windows 真实 GUI 验收(用户复测通过):以 26 行 × 7 列长表格(
test1.tmu)为样本,全选 → AI 操作栏「对话」,面板 447×502 实测:另验证:侧边栏已开时重复发起「对话」、短文本选区(输入框回落 3 行档)均正常。