Commit cdfdaefb authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Dim the path color slightly to make the filename standout more

parent 5d2c5652
Pipeline #133612 passed with stage
in 2 minutes and 25 seconds
......@@ -554,7 +554,19 @@ QString MatchModel::fileToHtmlString(const MatchFile &matchFile) const
}
path = path.toHtmlEscaped();
path.remove(m_resultBaseDir);
QString tmpStr = QStringLiteral("%1<b>%2: %3</b>").arg(path, matchFile.fileUrl.fileName().toHtmlEscaped()).arg(matchFile.matches.size());
// dim the path color slightly
const auto fgColor = QColor(m_foregroundColor);
QString fg;
if (fgColor.lightness() < 127) {
fg = fgColor.lighter(150).name();
} else {
fg = fgColor.darker(150).name();
}
QString tmpStr = QStringLiteral("<span style=\"color:%1;\">%2</span><b>%3: %4</b>")
.arg(fg)
.arg(path)
.arg(matchFile.fileUrl.fileName().toHtmlEscaped())
.arg(matchFile.matches.size());
return tmpStr;
}
......
......@@ -47,7 +47,7 @@ SPHtmlDelegate::SPHtmlDelegate(QObject *parent)
static int lineNumAreaWidth(const QModelIndex &index, const QFontMetrics &fm)
{
const auto lastRangeForFile = index.parent().data(MatchModel::LastMatchedRangeInFile).value<KTextEditor::Range>();
const QString lineCol = QStringLiteral("%1:%2").arg(lastRangeForFile.start().line()).arg(lastRangeForFile.start().column());
const QString lineCol = QStringLiteral("%1:%2").arg(lastRangeForFile.start().line() + 1).arg(lastRangeForFile.start().column() + 1);
return fm.horizontalAdvance(lineCol);
}
......
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