"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/qcodeedit/lib/document/qdocumentsearch.cpp" between
texstudio-2.12.18.tar.gz and texstudio-2.12.20.tar.gz

About: TeXstudio is an integrated environment for writing LaTeX documents (as easy and comfortable as possible).

qdocumentsearch.cpp  (texstudio-2.12.18):qdocumentsearch.cpp  (texstudio-2.12.20)
skipping to change at line 159 skipping to change at line 159
while ( !hc.atEnd() && hscope.isWithinSelection(hc)) while ( !hc.atEnd() && hscope.isWithinSelection(hc))
{ {
int ln = hc.lineNumber(); int ln = hc.lineNumber();
QDocumentLine l = hc.line(); QDocumentLine l = hc.line();
//TODO: Why is this needed ????? It makes absolutely no sense, b ut if it isn't there, deleting a search text step by step and then adding the ch aracters again, creates artifact overlays //TODO: Why is this needed ????? It makes absolutely no sense, b ut if it isn't there, deleting a search text step by step and then adding the ch aracters again, creates artifact overlays
l.setFlag(QDocumentLine::FormatsApplied, false); l.setFlag(QDocumentLine::FormatsApplied, false);
const QString &s = boundaries.endLine != ln ? l.text() : l.text() .left(boundaries.end); const QString &s = boundaries.endLine != ln ? l.text() : l.text() .left(boundaries.end);
#if QT_VERSION > 0x050500 #if QT_VERSION > 0x050500
m_match=m_regularExpression.match(s, hc.columnNumber()); QRegularExpressionMatch match=m_regularExpression.match(s, hc.columnNumb
int column = m_match.capturedStart(); er());
int length = m_match.capturedLength(); int column = match.capturedStart();
int length = match.capturedLength();
#else #else
int column=m_regexp.indexIn(s, hc.columnNumber()); int column=m_regexp.indexIn(s, hc.columnNumber());
int length=m_regexp.matchedLength(); int length=m_regexp.matchedLength();
#endif #endif
/* /*
qDebug("searching %s in %s => %i", qDebug("searching %s in %s => %i",
qPrintable(m_regexp.pattern()), qPrintable(m_regexp.pattern()),
qPrintable(s), qPrintable(s),
column); column);
skipping to change at line 609 skipping to change at line 609
if ( backward ) if ( backward )
m_cursor.movePosition(1, QDocumentCursor::End); m_cursor.movePosition(1, QDocumentCursor::End);
} else { } else {
QMessageBox::warning(nullptr, nullptr, "Unable to perform search operation"); QMessageBox::warning(nullptr, nullptr, "Unable to perform search operation");
} }
} }
QDocumentCursor firstMatch; QDocumentCursor firstMatch;
recreateRegExp(); recreateRegExp();
int replaceCount = 0; int replaceCount = 0;
// replace // replace
if (hasOption(Replace) && again && !all) { if (hasOption(Replace) && again && !all) {
bool replaceSelectedText = false; bool replaceSelectedText = false;
#if QT_VERSION > 0x050500 #if QT_VERSION > 0x050500
qDebug()<<m_match.hasMatch() << m_match.captured();
if (m_match.hasMatch() && m_match.captured()==m_cursor.selectedTe xt()) { if (m_match.hasMatch() && m_match.captured()==m_cursor.selectedTe xt()) {
replaceSelectedText = true; replaceSelectedText = true;
} else if (m_regularExpression.pattern().contains("(?=") || m_reg ularExpression.pattern().contains("(?!")) { } else if (m_regularExpression.pattern().contains("(?=") || m_reg ularExpression.pattern().contains("(?!")) {
// special handling for lookahead: The selected text is n ot enough to match the regexp // special handling for lookahead: The selected text is n ot enough to match the regexp
// because the lookahead context is missing. Therefore we have to find matches to the // because the lookahead context is missing. Therefore we have to find matches to the
// whole line until we find the original selection. Only then, we know that the original // whole line until we find the original selection. Only then, we know that the original
// selection is match and should be replaced. // selection is match and should be replaced.
int start = 0; int start = 0;
while (true) { while (true) {
QRegularExpressionMatch match = m_regularExpressi on.match(m_cursor.line().text(), start); QRegularExpressionMatch match = m_regularExpressi on.match(m_cursor.line().text(), start);
skipping to change at line 668 skipping to change at line 669
} }
#endif #endif
if (replaceSelectedText) { if (replaceSelectedText) {
replaceCursorText(backward); replaceCursorText(backward);
updateReplacementOverlays(); updateReplacementOverlays();
replaceCount++; replaceCount++;
//foundCount++; we can't set this here, because it has to search the next match //foundCount++; we can't set this here, because it has to search the next match
//and if (foundCount) is true, it thinks already found so mething and doesn't restart from scope //and if (foundCount) is true, it thinks already found so mething and doesn't restart from scope
} }
} }
// search next // search next
//ensure that the current selection isn't searched //ensure that the current selection isn't searched
if ( m_cursor.hasSelection() ) { if ( m_cursor.hasSelection() ) {
if (m_cursor.selectionStart() == scope.selectionStart() && if (m_cursor.selectionStart() == scope.selectionStart() &&
m_cursor.selectionEnd() == scope.selectionEnd()) { m_cursor.selectionEnd() == scope.selectionEnd()) {
//search whole scope //search whole scope
if (backward) m_cursor=scope.selectionEnd(); if (backward) m_cursor=scope.selectionEnd();
else m_cursor=scope.selectionStart(); else m_cursor=scope.selectionStart();
} else { } else {
 End of changes. 4 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)