Skip to content
GitLab
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
3dac5db1
Commit
3dac5db1
authored
Feb 18, 2022
by
Laurent Montel
Browse files
Fix support when we use FindBackward option
parent
1c9e0372
Pipeline
#139583
passed with stages
in 5 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/texteditor/commonwidget/findutils.cpp
View file @
3dac5db1
...
...
@@ -51,8 +51,13 @@ bool FindUtils::find(QPlainTextEdit *view, const QString &searchText, QTextDocum
c
=
doc
.
find
(
FindUtils
::
normalize
(
searchText
),
c
,
searchOptions
);
if
(
!
c
.
isNull
())
{
qDebug
()
<<
" c.selectionStart() "
<<
c
.
selectionStart
()
<<
"c.selectionEnd() "
<<
c
.
selectionEnd
();
docCusor
.
setPosition
(
c
.
selectionStart
());
docCusor
.
setPosition
(
c
.
selectionEnd
(),
QTextCursor
::
KeepAnchor
);
if
(
searchOptions
&
QTextDocument
::
FindBackward
)
{
docCusor
.
setPosition
(
c
.
selectionEnd
());
docCusor
.
setPosition
(
c
.
selectionStart
(),
QTextCursor
::
KeepAnchor
);
}
else
{
docCusor
.
setPosition
(
c
.
selectionStart
());
docCusor
.
setPosition
(
c
.
selectionEnd
(),
QTextCursor
::
KeepAnchor
);
}
view
->
setTextCursor
(
docCusor
);
view
->
ensureCursorVisible
();
return
true
;
...
...
@@ -71,8 +76,13 @@ bool FindUtils::find(QTextEdit *view, const QString &searchText, QTextDocument::
c
=
doc
.
find
(
FindUtils
::
normalize
(
searchText
),
c
,
searchOptions
);
if
(
!
c
.
isNull
())
{
qDebug
()
<<
" c.selectionStart() "
<<
c
.
selectionStart
()
<<
"c.selectionEnd() "
<<
c
.
selectionEnd
();
docCusor
.
setPosition
(
c
.
selectionStart
());
docCusor
.
setPosition
(
c
.
selectionEnd
(),
QTextCursor
::
KeepAnchor
);
if
(
searchOptions
&
QTextDocument
::
FindBackward
)
{
docCusor
.
setPosition
(
c
.
selectionEnd
());
docCusor
.
setPosition
(
c
.
selectionStart
(),
QTextCursor
::
KeepAnchor
);
}
else
{
docCusor
.
setPosition
(
c
.
selectionStart
());
docCusor
.
setPosition
(
c
.
selectionEnd
(),
QTextCursor
::
KeepAnchor
);
}
view
->
setTextCursor
(
docCusor
);
view
->
ensureCursorVisible
();
return
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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