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
Utilities
Kate
Commits
dd06221f
Commit
dd06221f
authored
May 25, 2021
by
Kåre Särs
Browse files
S&R: Fix matching ^ and $ in multi-line expressions
BUG: 318232
parent
bfc6343b
Changes
1
Show whitespace changes
Inline
Side-by-side
addons/search/plugin_search.cpp
View file @
dd06221f
...
...
@@ -987,10 +987,15 @@ void KatePluginSearchView::startSearch()
return
;
}
QRegularExpression
::
PatternOptions
patternOptions
=
(
m_ui
.
matchCase
->
isChecked
()
?
QRegularExpression
::
UseUnicodePropertiesOption
:
QRegularExpression
::
UseUnicodePropertiesOption
|
QRegularExpression
::
CaseInsensitiveOption
);
QString
pattern
=
(
m_ui
.
useRegExp
->
isChecked
()
?
currentSearchText
:
QRegularExpression
::
escape
(
currentSearchText
));
QRegularExpression
::
PatternOptions
patternOptions
=
QRegularExpression
::
UseUnicodePropertiesOption
;
if
(
!
m_ui
.
matchCase
->
isChecked
())
{
patternOptions
|=
QRegularExpression
::
CaseInsensitiveOption
;
}
if
(
pattern
.
contains
(
QLatin1String
(
"
\\
n"
)))
{
patternOptions
|=
QRegularExpression
::
MultilineOption
;
}
QRegularExpression
reg
(
pattern
,
patternOptions
);
if
(
!
reg
.
isValid
())
{
...
...
@@ -1157,11 +1162,16 @@ void KatePluginSearchView::startSearchWhileTyping()
// Now we should have a true typed text change
QRegularExpression
::
PatternOptions
patternOptions
=
(
m_ui
.
matchCase
->
isChecked
()
?
QRegularExpression
::
UseUnicodePropertiesOption
:
QRegularExpression
::
UseUnicodePropertiesOption
|
QRegularExpression
::
CaseInsensitiveOption
);
QString
pattern
=
(
m_ui
.
useRegExp
->
isChecked
()
?
currentSearchText
:
QRegularExpression
::
escape
(
currentSearchText
));
QRegularExpression
::
PatternOptions
patternOptions
=
QRegularExpression
::
UseUnicodePropertiesOption
;
if
(
!
m_ui
.
matchCase
->
isChecked
())
{
patternOptions
|=
QRegularExpression
::
CaseInsensitiveOption
;
}
if
(
pattern
.
contains
(
QLatin1String
(
"
\\
n"
)))
{
patternOptions
|=
QRegularExpression
::
MultilineOption
;
}
QRegularExpression
reg
(
pattern
,
patternOptions
);
if
(
!
reg
.
isValid
())
{
// qDebug() << "invalid regexp";
indicateMatch
(
false
);
...
...
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