Changeset View
Changeset View
Standalone View
Standalone View
src/lib/abstracthighlighter.cpp
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | |||||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | State AbstractHighlighter::highlightLine(const QString& text, const State &state) | 115 | State AbstractHighlighter::highlightLine(const QString& text, const State &state) | ||
116 | { | 116 | { | ||
117 | Q_D(AbstractHighlighter); | 117 | Q_D(AbstractHighlighter); | ||
118 | 118 | | |||
119 | // verify definition, deal with no highlighting being enabled | 119 | // verify definition, deal with no highlighting being enabled | ||
120 | d->ensureDefinitionLoaded(); | 120 | d->ensureDefinitionLoaded(); | ||
121 | if (!d->m_definition.isValid()) { | 121 | const auto defData = DefinitionData::get(d->m_definition); | ||
122 | if (!d->m_definition.isValid() || !defData->isLoaded()) { | ||||
122 | applyFormat(0, text.size(), Format()); | 123 | applyFormat(0, text.size(), Format()); | ||
123 | return State(); | 124 | return State(); | ||
124 | } | 125 | } | ||
125 | 126 | | |||
126 | // verify/initialize state | 127 | // verify/initialize state | ||
127 | auto defData = DefinitionData::get(d->m_definition); | | |||
128 | auto newState = state; | 128 | auto newState = state; | ||
129 | auto stateData = StateData::get(newState); | 129 | auto stateData = StateData::get(newState); | ||
130 | const DefinitionRef currentDefRef(d->m_definition); | 130 | const DefinitionRef currentDefRef(d->m_definition); | ||
131 | if (!stateData->isEmpty() && (stateData->m_defRef != currentDefRef)) { | 131 | if (!stateData->isEmpty() && (stateData->m_defRef != currentDefRef)) { | ||
132 | qCDebug(Log) << "Got invalid state, resetting."; | 132 | qCDebug(Log) << "Got invalid state, resetting."; | ||
133 | stateData->clear(); | 133 | stateData->clear(); | ||
134 | } | 134 | } | ||
135 | if (stateData->isEmpty()) { | 135 | if (stateData->isEmpty()) { | ||
▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines |