Commit c72ff527 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix replace all in richtextedit editor + remove old comment

parent a3741e4a
Pipeline #147671 passed with stages
in 3 minutes and 3 seconds
......@@ -64,7 +64,6 @@ bool PlainTextEditFindBar::searchInDocument(const QString &text, TextEditFindBar
bool PlainTextEditFindBar::searchInDocument(const QRegularExpression &regExp, TextEditFindBarBase::FindFlags searchOptions)
{
// TODO implement support for FindRespectDiacritics ?
const bool found = d->mView->find(regExp, FindUtils::convertTextEditFindFlags(searchOptions));
mFindWidget->setFoundMatch(found);
return found;
......@@ -77,7 +76,6 @@ void PlainTextEditFindBar::autoSearchMoveCursor()
d->mView->setTextCursor(cursor);
}
// TODO add support for FindRespectDiacritics
void PlainTextEditFindBar::slotReplaceText()
{
const TextEditFindBarBase::FindFlags searchOptions = mFindWidget->searchOptions();
......
......@@ -78,7 +78,7 @@ void RichTextEditFindBar::autoSearchMoveCursor()
void RichTextEditFindBar::slotReplaceText()
{
// FIXME!
const TextEditFindBarBase::FindFlags searchOptions = mFindWidget->searchOptions();
if (d->mView->textCursor().hasSelection()) {
if (mFindWidget->isRegularExpression()) {
if (d->mView->textCursor().selectedText().contains(mFindWidget->searchRegularExpression())) {
......@@ -87,10 +87,18 @@ void RichTextEditFindBar::slotReplaceText()
searchText(false, false);
}
} else {
if (d->mView->textCursor().selectedText() == mFindWidget->searchText()) {
d->mView->textCursor().insertText(mReplaceWidget->replaceLineEdit()->text());
// search next after replace text.
searchText(false, false);
if (searchOptions & TextEditFindBarBase::FindRespectDiacritics) {
if (FindUtils::normalize(d->mView->textCursor().selectedText()) == FindUtils::normalize(mFindWidget->searchText())) {
d->mView->textCursor().insertText(mReplaceWidget->replaceLineEdit()->text());
// search next after replace text.
searchText(false, false);
} else {
if (d->mView->textCursor().selectedText() == mFindWidget->searchText()) {
d->mView->textCursor().insertText(mReplaceWidget->replaceLineEdit()->text());
// search next after replace text.
searchText(false, false);
}
}
}
}
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment