Commit 9d15d1a7 authored by Kåre Särs's avatar 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
......@@ -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 &replaseBackground)
void MatchModel::setMatchColors(const QColor &foreground, const QColor &background, const QColor &replaceBackground, const QColor &lineNrBackground)
{
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>) &nbsp;")
QString displayText = QStringLiteral("<span style=\"background-color:%1; color:%2;\">&nbsp;<b>%3:%4:</b></span>&nbsp;")
.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;
......
......@@ -83,7 +83,7 @@ public:
void setDocumentManager(KTextEditor::Application *manager);
void setMatchColors(const QColor &foreground, const QColor &background, const QColor &replaseBackground);
void setMatchColors(const QColor &foreground, const QColor &background, const QColor &replaceBackground, const QColor &lineNrBackground);
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;
......
......@@ -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);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment