Commit 25e4655d authored by Leandro Melo's avatar Leandro Melo
Browse files

Generic highlighter: Apply format only if it's a configured one; Remove hard-coded colors.

Reviewed-by: con
parent 88ba37f8
......@@ -382,8 +382,10 @@ void Highlighter::applyFormat(int offset,
TextFormatId formatId = m_kateFormats.m_ids.value(itemData->style());
if (formatId != Normal) {
QTextCharFormat format = m_creatorFormats.value(formatId);
QHash<TextFormatId, QTextCharFormat>::const_iterator cit =
m_creatorFormats.constFind(formatId);
if (cit != m_creatorFormats.constEnd()) {
QTextCharFormat format = cit.value();
if (itemData->isCustomized()) {
// Please notice that the following are applied every time for item datas which have
// customizations. The configureFormats method could be used to provide a "one time"
......@@ -406,6 +408,7 @@ void Highlighter::applyFormat(int offset,
setFormat(offset, count, format);
}
}
}
void Highlighter::createWillContinueBlock()
......
......@@ -134,20 +134,6 @@ void PlainTextEditor::setFontSettings(const FontSettings &fs)
highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(
QLatin1String(Constants::C_STRING)));
// Creator does not have corresponding formats for the following ones. Implement them?
// For now I will leave hardcoded values.
QTextCharFormat format;
format.setForeground(Qt::blue);
highlighter->configureFormat(Highlighter::Others, format);
format.setForeground(Qt::red);
highlighter->configureFormat(Highlighter::Alert, format);
format.setForeground(Qt::darkBlue);
highlighter->configureFormat(Highlighter::Function, format);
format.setForeground(Qt::darkGray);
highlighter->configureFormat(Highlighter::RegionMarker, format);
format.setForeground(Qt::darkRed);
highlighter->configureFormat(Highlighter::Error, format);
highlighter->rehighlight();
}
}
......
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