Commit 737bdb20 authored by Dominik Haumann's avatar Dominik Haumann

Search & Replace Plugin: Set foreground color for matches to default foreground text color

This improves the readability a lot, since the background color now does
not have to have good contrast with ALL foreground colors in the color scheme.
Instead, it only needs to have good contrast in only one case.
This also helps for dark color schemes.

This is the application addition for review 127554.
CHANGELOG: Improved foreground color contrast for search & replace highlightings
parent d1e3f6fa
......@@ -677,8 +677,9 @@ void KatePluginSearchView::addMatchMark(KTextEditor::Document* doc, int line, in
if (!doc) return;
KTextEditor::View* activeView = m_mainWindow->activeView();
KTextEditor::MovingInterface* miface = qobject_cast<KTextEditor::MovingInterface*>(doc);
KTextEditor::ConfigInterface* ciface = qobject_cast<KTextEditor::ConfigInterface*>(m_mainWindow->activeView());
KTextEditor::ConfigInterface* ciface = qobject_cast<KTextEditor::ConfigInterface*>(activeView);
KTextEditor::Attribute::Ptr attr(new KTextEditor::Attribute());
bool replace = ((sender() == &m_replacer) || (sender() == 0) || (sender() == m_ui.replaceButton));
......@@ -686,15 +687,23 @@ void KatePluginSearchView::addMatchMark(KTextEditor::Document* doc, int line, in
QColor replaceColor(Qt::green);
if (ciface) replaceColor = ciface->configValue(QStringLiteral("replace-highlight-color")).value<QColor>();
if (activeView) {
else {
QColor searchColor(Qt::yellow);
if (ciface) searchColor = ciface->configValue(QStringLiteral("search-highlight-color")).value<QColor>();
if (activeView) {
// calculate end line in case of multi-line match
int endLine = line;
int endColumn = column+matchLen;
int endColumn = column + matchLen;
while ((endLine < doc->lines()) && (endColumn > doc->line(endLine).size())) {
endColumn -= doc->line(endLine).size();
endColumn--; // remove one for '\n'
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