forked from qt-creator/qt-creator
No need to set format when text is normal.
This commit is contained in:
@@ -300,12 +300,12 @@ void Highlighter::applyFormat(int offset,
|
||||
try {
|
||||
itemData = definition->itemData(itemDataName);
|
||||
} catch (const HighlighterException &) {
|
||||
// Although the formatting is skipped this case does not break the highlighter. In fact,
|
||||
// currently there are broken xml definition files which Kate can cope with. For instance,
|
||||
// the Printf context in java.xml points to an inexistent Printf item data.
|
||||
// There are broken files which Kate can cope with. For instance the Printf context in
|
||||
// java.xml points to an inexistent Printf item data. These are taken as normal text.
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemData->style() != ItemData::kDsNormal) {
|
||||
QTextCharFormat format = m_genericFormats.value(itemData->style());
|
||||
|
||||
if (itemData->isCustomized()) {
|
||||
@@ -313,9 +313,9 @@ void Highlighter::applyFormat(int offset,
|
||||
// customizations. The configureFormats method could be used to provide a "one time"
|
||||
// configuration, but it would probably require to traverse all item datas from all
|
||||
// definitions available/loaded (either to set the values or for some "notifying"
|
||||
// strategy). This is because the highlighter does not really know on which definition(s)
|
||||
// it is working. Since not many item datas specify customizations I think this approach
|
||||
// would fit better. If there are other ideas...
|
||||
// strategy). This is because the highlighter does not really know on which
|
||||
// definition(s) it is working. Since not many item datas specify customizations I
|
||||
// think this approach would fit better. If there are other ideas...
|
||||
if (itemData->color().isValid())
|
||||
format.setForeground(itemData->color());
|
||||
if (itemData->isItalicSpecified())
|
||||
@@ -330,6 +330,7 @@ void Highlighter::applyFormat(int offset,
|
||||
|
||||
setFormat(offset, count, format);
|
||||
}
|
||||
}
|
||||
|
||||
void Highlighter::applyVisualWhitespaceFormat(const QString &text)
|
||||
{
|
||||
@@ -443,8 +444,6 @@ void Highlighter::configureFormats(const TextEditor::FontSettings & fs)
|
||||
m_visualWhitespaceFormat = fs.toTextCharFormat(
|
||||
QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE));
|
||||
|
||||
m_genericFormats[ItemData::kDsNormal] = fs.toTextCharFormat(
|
||||
QLatin1String(TextEditor::Constants::C_TEXT));
|
||||
m_genericFormats[ItemData::kDsKeyword] = fs.toTextCharFormat(
|
||||
QLatin1String(TextEditor::Constants::C_KEYWORD));
|
||||
m_genericFormats[ItemData::kDsDataType] = fs.toTextCharFormat(
|
||||
|
||||
Reference in New Issue
Block a user