forked from qt-creator/qt-creator
Reuse FileSearchResultList
Change-Id: I2a20167faf78fcfa3b4bf392a42e0a72d92cd68e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -113,7 +113,6 @@ void runSilverSeacher(FutureInterfaceType &fi, FileFindParameters parameters)
|
||||
process.setCommand({"ag", arguments});
|
||||
process.start();
|
||||
if (process.waitForFinished()) {
|
||||
typedef QList<FileSearchResult> FileSearchResultList;
|
||||
QRegularExpression regexp;
|
||||
if (parameters.flags & FindRegularExpression) {
|
||||
const QRegularExpression::PatternOptions patternOptions
|
||||
|
||||
@@ -51,7 +51,7 @@ void OutputParserTest::test()
|
||||
QFETCH(QString, parserOutput);
|
||||
QFETCH(FileSearchResultList, results);
|
||||
SilverSearcher::SilverSearcherOutputParser ssop(parserOutput);
|
||||
const QList<Utils::FileSearchResult> items = ssop.parse();
|
||||
const FileSearchResultList items = ssop.parse();
|
||||
QCOMPARE(items, results);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ SilverSearcherOutputParser::SilverSearcherOutputParser(
|
||||
hasRegexp = !regexp.pattern().isEmpty();
|
||||
}
|
||||
|
||||
QList<Utils::FileSearchResult> SilverSearcherOutputParser::parse()
|
||||
Utils::FileSearchResultList SilverSearcherOutputParser::parse()
|
||||
{
|
||||
while (index < outputSize - 1) {
|
||||
if (output[index] == '\n') {
|
||||
|
||||
@@ -16,7 +16,7 @@ class SilverSearcherOutputParser
|
||||
public:
|
||||
SilverSearcherOutputParser(const QString &output, const QRegularExpression ®exp = {});
|
||||
|
||||
QList<Utils::FileSearchResult> parse();
|
||||
Utils::FileSearchResultList parse();
|
||||
|
||||
private:
|
||||
int parseMatches();
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
int outputSize = 0;
|
||||
int index = 0;
|
||||
Utils::FileSearchResult item;
|
||||
QList<Utils::FileSearchResult> items;
|
||||
Utils::FileSearchResultList items;
|
||||
};
|
||||
|
||||
} // namespace SilverSearcher
|
||||
|
||||
@@ -6304,8 +6304,8 @@ void TextEditorWidgetPrivate::searchResultsReady(int beginIndex, int endIndex)
|
||||
{
|
||||
QVector<SearchResult> results;
|
||||
for (int index = beginIndex; index < endIndex; ++index) {
|
||||
const QList<Utils::FileSearchResult> resultList = m_searchWatcher->resultAt(index);
|
||||
for (Utils::FileSearchResult result : resultList) {
|
||||
const FileSearchResultList resultList = m_searchWatcher->resultAt(index);
|
||||
for (FileSearchResult result : resultList) {
|
||||
const QTextBlock &block = q->document()->findBlockByNumber(result.lineNumber - 1);
|
||||
const int matchStart = block.position() + result.matchStart;
|
||||
QTextCursor cursor(block);
|
||||
@@ -6360,9 +6360,9 @@ void TextEditorWidgetPrivate::highlightSearchResultsInScrollBar()
|
||||
adjustScrollBarRanges();
|
||||
|
||||
m_searchWatcher = new QFutureWatcher<FileSearchResultList>();
|
||||
connect(m_searchWatcher, &QFutureWatcher<Utils::FileSearchResultList>::resultsReadyAt,
|
||||
connect(m_searchWatcher, &QFutureWatcher<FileSearchResultList>::resultsReadyAt,
|
||||
this, &TextEditorWidgetPrivate::searchResultsReady);
|
||||
connect(m_searchWatcher, &QFutureWatcher<Utils::FileSearchResultList>::finished,
|
||||
connect(m_searchWatcher, &QFutureWatcher<FileSearchResultList>::finished,
|
||||
this, &TextEditorWidgetPrivate::searchFinished);
|
||||
m_searchWatcher->setPendingResultsLimit(10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user