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
2ec2e907
Commit
2ec2e907
authored
Feb 27, 2022
by
Alexander Neundorf
Committed by
Alexander Neundorf
Mar 05, 2022
Browse files
Search&Replace add "Role" to LastMatchedRangeInFile
All other values of MatchDataRoles also end with "Role"
parent
ac51ba10
Pipeline
#145596
passed with stage
in 2 minutes and 22 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
addons/search/MatchModel.cpp
View file @
2ec2e907
...
...
@@ -939,7 +939,7 @@ QVariant MatchModel::data(const QModelIndex &index, int role) const
return
m_matchFiles
[
fileRow
].
fileUrl
;
case
PlainTextRole
:
return
fileToPlainText
(
m_matchFiles
[
fileRow
]);
case
LastMatchedRangeInFile
:
case
LastMatchedRangeInFile
Role
:
if
(
m_matchFiles
[
fileRow
].
matches
.
isEmpty
())
{
qWarning
()
<<
"Unexpected empty matches for file!"
;
return
{};
...
...
@@ -980,7 +980,7 @@ QVariant MatchModel::data(const QModelIndex &index, int role) const
return
matchToPlainText
(
match
);
case
MatchItem
:
return
QVariant
::
fromValue
(
match
);
case
LastMatchedRangeInFile
:
case
LastMatchedRangeInFile
Role
:
qWarning
()
<<
"Requested last matched line from a match item instead of file item1"
;
return
{};
}
...
...
addons/search/MatchModel.h
View file @
2ec2e907
...
...
@@ -60,7 +60,7 @@ public:
ReplaceTextRole
,
PlainTextRole
,
MatchItem
,
LastMatchedRangeInFile
,
LastMatchedRangeInFile
Role
,
};
Q_ENUM
(
MatchDataRoles
)
...
...
addons/search/SearchResultsDelegate.cpp
View file @
2ec2e907
...
...
@@ -51,7 +51,7 @@ SearchResultsDelegate::SearchResultsDelegate(QObject *parent)
static
int
lineNumAreaWidth
(
const
QModelIndex
&
index
,
const
QFontMetrics
&
fm
)
{
const
auto
lastRangeForFile
=
index
.
parent
().
data
(
MatchModel
::
LastMatchedRangeInFile
).
value
<
KTextEditor
::
Range
>
();
const
auto
lastRangeForFile
=
index
.
parent
().
data
(
MatchModel
::
LastMatchedRangeInFile
Role
).
value
<
KTextEditor
::
Range
>
();
const
QString
lineCol
=
QStringLiteral
(
"%1:%2"
).
arg
(
lastRangeForFile
.
start
().
line
()
+
1
).
arg
(
lastRangeForFile
.
start
().
column
()
+
1
);
return
fm
.
horizontalAdvance
(
lineCol
);
}
...
...
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