Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KPimTextEdit
Commits
c72ff527
Commit
c72ff527
authored
Mar 10, 2022
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/texteditor/plaintexteditor/plaintexteditfindbar.cpp
View file @
c72ff527
...
...
@@ -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
();
...
...
src/texteditor/richtexteditor/richtexteditfindbar.cpp
View file @
c72ff527
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment