Skip to content

fix: show mismatch alert for ReplaceBar when keyword is not found - #630

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix/replacebar-mismatch-alert
Oct 8, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:fix/replacebar-mismatch-alert

Conversation

@add-uos

@add-uos add-uos commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

问题

Window::handleUpdateSearchKeyword() 中 ReplaceBar 分支的空关键词与非空关键词两个分支都调用 setMismatchAlert(false),已计算出的高亮结果 findKeyword 被忽略——替换栏关键词未命中时永不显示 mismatch 告警。上方 FindBar 分支正确使用了 setMismatchAlert(!findKeyword),两分支行为不一致,疑为复制粘贴遗漏。

修复

ReplaceBar else 分支改为与 FindBar 一致的 setMismatchAlert(!findKeyword)。

背景

该问题由 AI 辅助单测(PMS 缺陷热点补强,编写 BUG65228 回归用例时审查发现)。

Summary by Sourcery

Bug Fixes:

  • Show a mismatch alert in ReplaceBar when a non-empty search keyword is not found.

The ReplaceBar branch passed false to setMismatchAlert() in both the
empty-keyword and the non-empty-keyword case, ignoring the highlight
result, so the mismatch alert never showed for the replace bar. The
FindBar branch above already uses !findKeyword; align ReplaceBar with it.

Log:
Influence: find/replace bar

--
@sourcery-ai

sourcery-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Fixes ReplaceBar’s non-empty keyword path to honor the search result and show a mismatch alert when the keyword is not found, matching FindBar behavior while preserving the existing empty-keyword handling.

Sequence diagram for ReplaceBar mismatch alert handling

sequenceDiagram
    participant ReplaceBar
    participant Window
    participant Search

    ReplaceBar->>Window: handleUpdateSearchKeyword(widget, file, keyword)
    Window->>Search: findKeyword
    alt keyword is empty
        Window->>ReplaceBar: setMismatchAlert(false)
    else keyword is not empty
        alt keyword is found
            Window->>ReplaceBar: setMismatchAlert(false)
        else keyword is not found
            Window->>ReplaceBar: setMismatchAlert(true)
        end
    end
Loading

File-Level Changes

Change Details Files
Make ReplaceBar display a mismatch alert when a non-empty replacement keyword does not match.
  • Use the existing findKeyword result to call setMismatchAlert(!findKeyword).
  • Update debug logging to report the computed alert state.
src/widgets/window.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos

add-uos commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@add-uos

add-uos commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unknown)

@deepin-bot
deepin-bot Bot merged commit c70bb6c into linuxdeepin:master Oct 8, 2026
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants