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
Utilities
Kate
Commits
9d15d1a7
Commit
9d15d1a7
authored
Jan 17, 2021
by
Kåre Särs
Browse files
S&R Replace the braces around line numbers with background color
Use the background color of the icon border for line numbers
parent
b9c76240
Changes
3
Hide whitespace changes
Inline
Side-by-side
addons/search/MatchModel.cpp
View file @
9d15d1a7
...
...
@@ -144,11 +144,12 @@ void MatchModel::addMatches(const QUrl &fileUrl, const QVector<KateSearchMatch>
endInsertRows
();
}
void
MatchModel
::
setMatchColors
(
const
QColor
&
foreground
,
const
QColor
&
background
,
const
QColor
&
repla
se
Background
)
void
MatchModel
::
setMatchColors
(
const
QColor
&
foreground
,
const
QColor
&
background
,
const
QColor
&
repla
ceBackground
,
const
QColor
&
lineNr
Background
)
{
m_foregroundColor
=
foreground
;
m_searchBackgroundColor
=
background
;
m_replaceHighlightColor
=
replaseBackground
;
m_replaceHighlightColor
=
replaceBackground
;
m_lineNumberBackgroundColor
=
lineNrBackground
;
}
KateSearchMatch
*
MatchModel
::
matchFromIndex
(
const
QModelIndex
&
matchIndex
)
...
...
@@ -558,7 +559,8 @@ QString MatchModel::matchToHtmlString(const Match &match) const
post
=
post
.
toHtmlEscaped
();
// (line:col)[space][space] ...Line text pre [highlighted match] Line text post....
QString
displayText
=
QStringLiteral
(
"(<b>%1:%2</b>) "
)
QString
displayText
=
QStringLiteral
(
"<span style=
\"
background-color:%1; color:%2;
\"
> <b>%3:%4:</b></span> "
)
.
arg
(
m_lineNumberBackgroundColor
.
name
()).
arg
(
m_foregroundColor
.
name
())
.
arg
(
nbsFormated
(
match
.
range
.
start
().
line
()
+
1
,
3
))
.
arg
(
nbsFormated
(
match
.
range
.
start
().
column
()
+
1
,
3
))
+
pre
+
matchStr
+
post
;
...
...
@@ -655,7 +657,7 @@ QString MatchModel::matchToPlainText(const Match &match) const
replaceStr
.
replace
(
QLatin1Char
(
'\t'
),
QStringLiteral
(
"
\\
t"
));
// (line:col)[space][space] ...Line text pre [highlighted match] Line text post....
QString
displayText
=
QStringLiteral
(
"
(
%1:%2
)
"
)
QString
displayText
=
QStringLiteral
(
"%1:%2
:
"
)
.
arg
(
match
.
range
.
start
().
line
()
+
1
,
3
)
.
arg
(
match
.
range
.
start
().
column
()
+
1
,
3
)
+
pre
+
matchStr
+
post
;
return
displayText
;
...
...
addons/search/MatchModel.h
View file @
9d15d1a7
...
...
@@ -83,7 +83,7 @@ public:
void
setDocumentManager
(
KTextEditor
::
Application
*
manager
);
void
setMatchColors
(
const
QColor
&
foreground
,
const
QColor
&
background
,
const
QColor
&
repla
se
Background
);
void
setMatchColors
(
const
QColor
&
foreground
,
const
QColor
&
background
,
const
QColor
&
repla
ceBackground
,
const
QColor
&
lineNr
Background
);
void
setSearchPlace
(
MatchModel
::
SearchPlaces
searchPlace
);
...
...
@@ -172,6 +172,7 @@ private:
QColor
m_searchBackgroundColor
;
QColor
m_foregroundColor
;
QColor
m_replaceHighlightColor
;
QColor
m_lineNumberBackgroundColor
;
Qt
::
CheckState
m_infoCheckState
=
Qt
::
Checked
;
SearchPlaces
m_searchPlace
=
CurrentFile
;
...
...
addons/search/plugin_search.cpp
View file @
9d15d1a7
...
...
@@ -793,12 +793,19 @@ void KatePluginSearchView::updateSearchColors()
m_replaceHighlightColor
=
Qt
::
green
;
m_foregroundColor
=
QBrush
(
view
->
defaultStyleAttribute
(
KTextEditor
::
dsNormal
)
->
foreground
().
color
());
QColor
lineNrBackgroundColor
=
ciface
->
configValue
(
QStringLiteral
(
"icon-border-color"
)).
value
<
QColor
>
();
if
(
!
lineNrBackgroundColor
.
isValid
())
lineNrBackgroundColor
=
view
->
defaultStyleAttribute
(
KTextEditor
::
dsNormal
)
->
background
().
color
();
if
(
m_curResults
)
{
auto
*
delegate
=
qobject_cast
<
SPHtmlDelegate
*>
(
m_curResults
->
treeView
->
itemDelegate
());
if
(
delegate
)
{
delegate
->
setDisplayFont
(
ciface
->
configValue
(
QStringLiteral
(
"font"
)).
value
<
QFont
>
());
}
m_curResults
->
matchModel
.
setMatchColors
(
m_foregroundColor
.
color
(),
m_searchBackgroundColor
.
color
(),
m_replaceHighlightColor
.
color
());
m_curResults
->
matchModel
.
setMatchColors
(
m_foregroundColor
.
color
(),
m_searchBackgroundColor
.
color
(),
m_replaceHighlightColor
.
color
(),
lineNrBackgroundColor
);
}
}
}
...
...
Write
Preview
Supports
Markdown
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