From c563a32be10a544067fab321ca33df64bfc8f8de Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 11 Mar 2022 21:12:44 +0800 Subject: [PATCH] - fix: batch replace in file doesn't respect item check states in the find panel --- NEWS.md | 1 + RedPandaIDE/mainwindow.cpp | 2 ++ RedPandaIDE/mainwindow.ui | 2 +- RedPandaIDE/widgets/searchresultview.cpp | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 31cc9dab..73164670 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Red Panda C++ Version 1.0.0 - enhancement: adjust tab order in the find dialog - enhancement: highlight hits in the find panel's result list - enhancement: optimize startup time + - fix: batch replace in file doesn't respect item check states in the find panel Red Panda C++ Version 0.14.5 - fix: the "gnu c++ 20" option in compiler set options is wrong diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 437a188f..8ce33fd1 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -6035,6 +6035,8 @@ void MainWindow::on_btnReplace_clicked() contents = editor->contents(); for (int i=file->results.count()-1;i>=0;i--) { const PSearchResultTreeItem& item = file->results[i]; + if (!item->selected) + continue; QString line = contents[item->line-1]; if (line.mid(item->start-1,results->keyword.length())!=results->keyword) { QMessageBox::critical(editor, diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index f0c99c98..94094a1c 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -542,7 +542,7 @@ QTabWidget::South - 6 + 3 diff --git a/RedPandaIDE/widgets/searchresultview.cpp b/RedPandaIDE/widgets/searchresultview.cpp index e13a69e6..ffb51c7e 100644 --- a/RedPandaIDE/widgets/searchresultview.cpp +++ b/RedPandaIDE/widgets/searchresultview.cpp @@ -311,7 +311,6 @@ bool SearchResultTreeModel::setData(const QModelIndex &index, const QVariant &va if (!item) return false; if (role == Qt::CheckStateRole && mSelectable) { - PSearchResults results = mSearchResultModel->currentResults(); if (!results || !index.isValid() ) {