1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

style: change code in searchInText

This commit is contained in:
TriKriSta 2018-02-12 19:35:50 +02:00
parent ffb51e8a0e
commit f73021c376

View File

@ -582,7 +582,9 @@ bool GenericChatForm::searchInText(const QString& phrase, bool searchUp)
for (int i = startLine; searchUp ? i >= 0 : i < numLines; searchUp ? --i : ++i) {
ChatLine::Ptr l = lines[i];
if (l->getColumnCount() < 2) { continue; }
if (l->getColumnCount() < 2) {
continue;
}
ChatLineContent* content = l->getContent(1);
Text* text = static_cast<Text*>(content);
@ -596,20 +598,22 @@ bool GenericChatForm::searchInText(const QString& phrase, bool searchUp)
QString txt = content->getText();
if (txt.contains(phrase, Qt::CaseInsensitive)) {
int index = indexForSearchInLine(txt, phrase, searchUp);
if ((index == -1 && searchPoint.y() > -1)) {
text->deselectText();
searchPoint.setY(-1);
} else {
chatWidget->scrollToLine(l);
text->deselectText();
text->selectText(phrase, index);
searchPoint = QPoint(numLines - i, index);
isSearch = true;
if (!txt.contains(phrase, Qt::CaseInsensitive)) {
continue;
}
break;
}
int index = indexForSearchInLine(txt, phrase, searchUp);
if ((index == -1 && searchPoint.y() > -1)) {
text->deselectText();
searchPoint.setY(-1);
} else {
chatWidget->scrollToLine(l);
text->deselectText();
text->selectText(phrase, index);
searchPoint = QPoint(numLines - i, index);
isSearch = true;
break;
}
}