Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6e1a2b30 authored by Laurent Montel's avatar Laurent Montel 😁

Fix replace word when we use regexp

parent 5c366095
......@@ -90,10 +90,18 @@ void PlainTextEditFindBar::autoSearchMoveCursor()
void PlainTextEditFindBar::slotReplaceText()
{
if (d->mView->textCursor().hasSelection()) {
if (d->mView->textCursor().selectedText() == mFindWidget->searchText()) {
d->mView->textCursor().insertText(mReplaceWidget->replaceLineEdit()->text());
//search next after replace text.
searchText(false, false);
if (mFindWidget->isRegularExpression()) {
if (d->mView->textCursor().selectedText().contains(mFindWidget->searchRegExp())) {
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 {
searchText(false, false);
......
......@@ -90,10 +90,18 @@ void RichTextEditFindBar::slotReplaceText()
{
//FIXME!
if (d->mView->textCursor().hasSelection()) {
if (d->mView->textCursor().selectedText() == mFindWidget->searchText()) {
d->mView->textCursor().insertText(mReplaceWidget->replaceLineEdit()->text());
//search next after replace text.
searchText(false, false);
if (mFindWidget->isRegularExpression()) {
if (d->mView->textCursor().selectedText().contains(mFindWidget->searchRegExp())) {
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 {
searchText(false, false);
......
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