Repository navigation
Conversation
1. Root cause: clicking next/prev as the first find action of a session never registers the keyword (m_keywordForSearchAll stays empty), so Window::handleFindKeyword took the clear branch and never pushed highlightSearch to the rendered MarkdownView - the match scrolled into view but carried no highlight; pressing Enter first registers the keyword, which is why "Enter then click" works but "click first" loses the highlight (verified on the Qt 6.8.0 build of BUG-380705) 2. Fix: handleFindKeyword now registers the current keyword and always calls highlightKeywordInView, matching the Enter path (handleUpdateSearchKeyword) 3. Test: Window UT asserts click-first pushes highlightSearch to the injected renderer with the right keyword and advancing match index; EditWrapper UT adds Enter/click path-parity and LivePreview-then- ReadView flow scenarios for the scroll sync regression Log: fix find highlight missing when clicking next before enter Influence: 1. In read-only markdown view, press Ctrl+F and click Next directly without pressing Enter, verify the match is highlighted and centered 2. Test the same flow in edit mode and live preview, verify no regression 3. Verify render-page highlight follows subsequent next/prev clicks fix: 修复直接点击"下一个"时渲染页无查找高亮 1. 根因:会话内首个查找动作若直接点击"下一个/上一个"(未经回车路径 注册查找词),m_keywordForSearchAll为空使handleFindKeyword走清空 分支,渲染页收不到highlightSearch推送——匹配滚入视口却无任何高亮; 回车路径会注册查找词,故"先回车再点击"正常、"直接点击"丢高亮 (在BUG-380705修复版 Qt 6.8.0 构建上实测确认) 2. 方案:handleFindKeyword注册当前查找词并无条件调用 highlightKeywordInView,与回车路径行为对齐 3. 测试:Window单测断言点击先行也会向注入渲染器推送highlightSearch 且命中序号随点击推进;EditWrapper单测补充回车/点击路径一致性与 LivePreview进只读视图流程的滚动同步回归场景 Log: 修复只读Markdown视图下直接点击"下一个"渲染页无高亮的问题 Influence: 1. 在只读Markdown视图下Ctrl+F后不按回车、直接点击"下一个",验证匹配 内容带高亮且居中显示 2. 在编辑模式与实时预览下验证相同流程无回归 3. 验证渲染页高亮随后续点击"下一个/上一个"同步刷新 PMS: BUG-380705
|
Sorry @pengfeixx, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 5 hours and 24 minutes by commenting |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideFixes first-click find navigation so the active keyword is registered and rendered Markdown highlighting is pushed immediately, then adds unit and integration coverage for click-first behavior, match advancement, search-path parity, and ReadView transition scenarios. Sequence diagram for click-first find highlightingsequenceDiagram
actor User
participant Window
participant TextEditor
participant MarkdownView
User->>Window: handleFindKeyword(keyword, state)
Window->>TextEditor: updateCursorKeywordSelection(keyword, state)
Window->>Window: register m_keywordForSearchAll
Window->>TextEditor: highlightKeywordInView(keyword)
TextEditor->>MarkdownView: highlightSearch(keyword)
Window->>TextEditor: markAllKeywordInView()
MarkdownView-->>User: Render match highlighted and centered
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 当前修复已正确,无需额外修改。核心修复片段如下(window.cpp handleFindKeyword): // // if (QString::compare(m_keywordForSearch, m_keywordForSearchAll, // Qt::CaseInsensitive) != 0) { // qCDebug(appLog) << "m_keywordForSearchAll is not equal to m_keywordForSearch, register current keyword"; // m_keywordForSearchAll = m_keywordForSearch; // } // wrapper->textEditor()->highlightKeywordInView(m_keywordForSearchAll);本报告由 AI 代码审查工具自动生成 |
fix: sync find highlight to render page on first next click
never registers the keyword (m_keywordForSearchAll stays empty), so
Window::handleFindKeyword took the clear branch and never pushed
highlightSearch to the rendered MarkdownView - the match scrolled
into view but carried no highlight; pressing Enter first registers
the keyword, which is why "Enter then click" works but "click first"
loses the highlight (verified on the Qt 6.8.0 build of BUG-380705)
calls highlightKeywordInView, matching the Enter path
(handleUpdateSearchKeyword)
injected renderer with the right keyword and advancing match index;
EditWrapper UT adds Enter/click path-parity and LivePreview-then-
ReadView flow scenarios for the scroll sync regression
Log: fix find highlight missing when clicking next before enter
Influence:
without pressing Enter, verify the match is highlighted and centered
fix: 修复直接点击"下一个"时渲染页无查找高亮
注册查找词),m_keywordForSearchAll为空使handleFindKeyword走清空
分支,渲染页收不到highlightSearch推送——匹配滚入视口却无任何高亮;
回车路径会注册查找词,故"先回车再点击"正常、"直接点击"丢高亮
(在BUG-380705修复版 Qt 6.8.0 构建上实测确认)
highlightKeywordInView,与回车路径行为对齐
且命中序号随点击推进;EditWrapper单测补充回车/点击路径一致性与
LivePreview进只读视图流程的滚动同步回归场景
Log: 修复只读Markdown视图下直接点击"下一个"渲染页无高亮的问题
Influence:
内容带高亮且居中显示
PMS: BUG-380705
Summary by Sourcery
Synchronize rendered-page find highlights when navigating search results directly with Next or Previous.
Bug Fixes:
Tests: