diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp index fbc72dae950..890821c745f 100644 --- a/src/plugins/git/githighlighters.cpp +++ b/src/plugins/git/githighlighters.cpp @@ -137,23 +137,23 @@ void GitRebaseHighlighter::highlightBlock(const QString &text) setFormat(changeIndex, changeLen, formatForCategory(Format_Change)); changeIndex += changeLen; } - return; - } - - for (const RebaseAction &action : Utils::asConst(m_actions)) { - if (action.exp.indexIn(text) != -1) { - const int len = action.exp.matchedLength(); - setFormat(0, len, formatForCategory(action.formatCategory)); - const int changeIndex = m_changeNumberPattern.indexIn(text, len); - if (changeIndex != -1) { - const int changeLen = m_changeNumberPattern.matchedLength(); - const int descStart = changeIndex + changeLen + 1; - setFormat(changeIndex, changeLen, formatForCategory(Format_Change)); - setFormat(descStart, text.size() - descStart, formatForCategory(Format_Description)); + } else { + for (const RebaseAction &action : Utils::asConst(m_actions)) { + if (action.exp.indexIn(text) != -1) { + const int len = action.exp.matchedLength(); + setFormat(0, len, formatForCategory(action.formatCategory)); + const int changeIndex = m_changeNumberPattern.indexIn(text, len); + if (changeIndex != -1) { + const int changeLen = m_changeNumberPattern.matchedLength(); + const int descStart = changeIndex + changeLen + 1; + setFormat(changeIndex, changeLen, formatForCategory(Format_Change)); + setFormat(descStart, text.size() - descStart, formatForCategory(Format_Description)); + } + break; } - break; } } + formatSpaces(text); } } // namespace Internal diff --git a/src/plugins/vcsbase/baseannotationhighlighter.cpp b/src/plugins/vcsbase/baseannotationhighlighter.cpp index 461dfe74bbe..b95fe6a1793 100644 --- a/src/plugins/vcsbase/baseannotationhighlighter.cpp +++ b/src/plugins/vcsbase/baseannotationhighlighter.cpp @@ -111,7 +111,7 @@ void BaseAnnotationHighlighter::highlightBlock(const QString &text) const QString change = changeNumber(text); const ChangeNumberFormatMap::const_iterator it = d->m_changeNumberMap.constFind(change); if (it != d->m_changeNumberMap.constEnd()) - setFormat(0, text.length(), it.value()); + setFormatWithSpaces(text, 0, text.length(), it.value()); } void BaseAnnotationHighlighter::setFontSettings(const TextEditor::FontSettings &fontSettings) diff --git a/src/plugins/vcsbase/diffandloghighlighter.cpp b/src/plugins/vcsbase/diffandloghighlighter.cpp index 50b17d8f83b..3a2e89a1024 100644 --- a/src/plugins/vcsbase/diffandloghighlighter.cpp +++ b/src/plugins/vcsbase/diffandloghighlighter.cpp @@ -180,11 +180,13 @@ void DiffAndLogHighlighter::highlightBlock(const QString &text) if (format == TextEditor::C_ADDED_LINE) { // Mark trailing whitespace. const int trimmedLen = trimmedLength(text); - setFormat(0, trimmedLen, formatForCategory(format)); + setFormatWithSpaces(text, 0, trimmedLen, formatForCategory(format)); if (trimmedLen != length) setFormat(trimmedLen, length - trimmedLen, d->m_addedTrailingWhiteSpaceFormat); } else if (format != TextEditor::C_TEXT) { - setFormat(0, length, formatForCategory(format)); + setFormatWithSpaces(text, 0, length, formatForCategory(format)); + } else { + formatSpaces(text); } // codefolding: