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