Skip to content

Commit 08fb44e

Browse files
pengfeixxdeepin-bot[bot]
authored andcommitted
fix(editor): hardcode CaseSensitive in replace skip to fix highlight
Remove Qt::CaseSensitivity from replaceSkip signal to avoid QueuedConnection enum serialization failure. Hardcode CaseSensitive directly in handleReplaceSkip for correct case-sensitive highlight. 替换跳过信号不再传递caseFlag枚举参数,避免QueuedConnection 序列化丢失。在handleReplaceSkip中直接使用CaseSensitive, 确保跳过后仅高亮精确匹配的内容。 Log: 修复替换跳过后大小写不敏感的高亮问题 PMS: BUG-358129 Influence: 替换跳过后高亮仅匹配相同大小写的内容,不再误匹配不同大小写的文本。
1 parent 3ce1324 commit 08fb44e

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/controls/replacebar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void ReplaceBar::activeInput(QString text, QString file, int row, int column, in
133133
void ReplaceBar::handleSkip()
134134
{
135135
qDebug() << "handleSkip";
136-
emit replaceSkip(m_replaceFile, m_replaceLine->lineEdit()->text(), Qt::CaseSensitive);
136+
emit replaceSkip(m_replaceFile, m_replaceLine->lineEdit()->text());
137137
}
138138

139139
void ReplaceBar::replaceClose()

src/controls/replacebar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ReplaceBar : public DFloatingWidget
3636
Q_SIGNALS:
3737
void pressEsc();
3838
void replaceNext(QString file, QString replaceText, QString withText);
39-
void replaceSkip(QString file, QString keyword, Qt::CaseSensitivity caseFlag);
39+
void replaceSkip(QString file, QString keyword);
4040
void replaceRest(QString replaceText, QString withText);
4141
void replaceAll(QString replaceText, QString withText);
4242
void beforeReplace(QString _);

src/widgets/window.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,17 +3419,17 @@ void Window::handleReplaceRest(const QString &replaceText, const QString &withTe
34193419
qDebug() << "handleReplaceRest end";
34203420
}
34213421

3422-
void Window::handleReplaceSkip(QString file, QString keyword, Qt::CaseSensitivity caseFlag)
3422+
void Window::handleReplaceSkip(QString file, QString keyword)
34233423
{
3424-
qDebug() << "handleReplaceSkip" << file << keyword << caseFlag;
3424+
qDebug() << "handleReplaceSkip" << file << keyword;
34253425
EditWrapper *wrapper = currentWrapper();
3426-
handleUpdateSearchKeyword(m_replaceBar, file, keyword, caseFlag);
3426+
handleUpdateSearchKeyword(m_replaceBar, file, keyword, Qt::CaseSensitive);
34273427
if (QString::compare(m_keywordForSearch, m_keywordForSearchAll, Qt::CaseInsensitive) != 0) {
34283428
m_keywordForSearchAll.clear();
34293429
wrapper->textEditor()->clearFindMatchSelections();
34303430
qDebug() << "m_keywordForSearchAll is not equal to m_keywordForSearch, clear it";
34313431
} else {
3432-
wrapper->textEditor()->highlightKeywordInView(m_keywordForSearchAll, caseFlag);
3432+
wrapper->textEditor()->highlightKeywordInView(m_keywordForSearchAll, Qt::CaseSensitive);
34333433
qDebug() << "m_keywordForSearchAll is equal to m_keywordForSearch, highlight it";
34343434
}
34353435
#if 0

src/widgets/window.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public Q_SLOTS:
177177
void handleReplaceAll(const QString &replaceText, const QString &withText);
178178
void handleReplaceNext(const QString &file, const QString &replaceText, const QString &withText);
179179
void handleReplaceRest(const QString &replaceText, const QString &withText);
180-
void handleReplaceSkip(QString file, QString keyword, Qt::CaseSensitivity caseFlag);
180+
void handleReplaceSkip(QString file, QString keyword);
181181

182182
void handleRemoveSearchKeyword();
183183
void handleUpdateSearchKeyword(QWidget *widget, const QString &file, const QString &keyword,

tests/src/widgets/ut_window.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ TEST(UT_Window_handleReplaceSkip, UT_Window_handleReplaceSkip)
15021502
window->addTabWithWrapper(a,"aa","aad","aadd",0);
15031503
window->addTabWithWrapper(a,"bb","aad","aadd",1);
15041504
window->m_settings =Settings::instance();
1505-
window->handleReplaceSkip("aa", "", Qt::CaseSensitive);
1505+
window->handleReplaceSkip("aa", "");
15061506

15071507
EXPECT_NE(window,nullptr);
15081508
window->deleteLater();

0 commit comments

Comments
 (0)