Changeset View
Changeset View
Standalone View
Standalone View
src/lib/syntaxhighlighter.cpp
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 125 | { | |||
---|---|---|---|---|---|
151 | 151 | | |||
152 | const auto nextBlock = currentBlock().next(); | 152 | const auto nextBlock = currentBlock().next(); | ||
153 | if (nextBlock.isValid()) | 153 | if (nextBlock.isValid()) | ||
154 | QMetaObject::invokeMethod(this, "rehighlightBlock", Qt::QueuedConnection, Q_ARG(QTextBlock, nextBlock)); | 154 | QMetaObject::invokeMethod(this, "rehighlightBlock", Qt::QueuedConnection, Q_ARG(QTextBlock, nextBlock)); | ||
155 | } | 155 | } | ||
156 | 156 | | |||
157 | void SyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format& format) | 157 | void SyntaxHighlighter::applyFormat(int offset, int length, const KSyntaxHighlighting::Format& format) | ||
158 | { | 158 | { | ||
159 | if (format.isDefaultTextStyle(theme()) || length == 0) | 159 | if (length == 0) | ||
160 | return; | 160 | return; | ||
161 | 161 | | |||
162 | QTextCharFormat tf; | 162 | QTextCharFormat tf; | ||
163 | if (format.hasTextColor(theme())) | 163 | // always set the foreground color to avoid palette issues | ||
164 | tf.setForeground(format.textColor(theme())); | 164 | tf.setForeground(format.textColor(theme())); | ||
165 | | ||||
165 | if (format.hasBackgroundColor(theme())) | 166 | if (format.hasBackgroundColor(theme())) | ||
166 | tf.setBackground(format.backgroundColor(theme())); | 167 | tf.setBackground(format.backgroundColor(theme())); | ||
167 | | ||||
168 | if (format.isBold(theme())) | 168 | if (format.isBold(theme())) | ||
169 | tf.setFontWeight(QFont::Bold); | 169 | tf.setFontWeight(QFont::Bold); | ||
170 | if (format.isItalic(theme())) | 170 | if (format.isItalic(theme())) | ||
171 | tf.setFontItalic(true); | 171 | tf.setFontItalic(true); | ||
172 | if (format.isUnderline(theme())) | 172 | if (format.isUnderline(theme())) | ||
173 | tf.setFontUnderline(true); | 173 | tf.setFontUnderline(true); | ||
174 | if (format.isStrikeThrough(theme())) | 174 | if (format.isStrikeThrough(theme())) | ||
175 | tf.setFontStrikeOut(true); | 175 | tf.setFontStrikeOut(true); | ||
Show All 23 Lines |