Fix style of visualized whitespace for various vcs editors

Blame, log and git rebase editors.

Task-number: QTCREATORBUG-17735
Change-Id: Ifd23ba7b6ccf3ef98d3026cdc8c17fd88c97797c
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2017-05-08 10:52:28 +02:00
parent 1a9808d393
commit b289dbde3c
3 changed files with 19 additions and 17 deletions

View File

@@ -137,9 +137,7 @@ void GitRebaseHighlighter::highlightBlock(const QString &text)
setFormat(changeIndex, changeLen, formatForCategory(Format_Change)); setFormat(changeIndex, changeLen, formatForCategory(Format_Change));
changeIndex += changeLen; changeIndex += changeLen;
} }
return; } else {
}
for (const RebaseAction &action : Utils::asConst(m_actions)) { for (const RebaseAction &action : Utils::asConst(m_actions)) {
if (action.exp.indexIn(text) != -1) { if (action.exp.indexIn(text) != -1) {
const int len = action.exp.matchedLength(); const int len = action.exp.matchedLength();
@@ -154,6 +152,8 @@ void GitRebaseHighlighter::highlightBlock(const QString &text)
break; break;
} }
} }
}
formatSpaces(text);
} }
} // namespace Internal } // namespace Internal

View File

@@ -111,7 +111,7 @@ void BaseAnnotationHighlighter::highlightBlock(const QString &text)
const QString change = changeNumber(text); const QString change = changeNumber(text);
const ChangeNumberFormatMap::const_iterator it = d->m_changeNumberMap.constFind(change); const ChangeNumberFormatMap::const_iterator it = d->m_changeNumberMap.constFind(change);
if (it != d->m_changeNumberMap.constEnd()) 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) void BaseAnnotationHighlighter::setFontSettings(const TextEditor::FontSettings &fontSettings)

View File

@@ -180,11 +180,13 @@ void DiffAndLogHighlighter::highlightBlock(const QString &text)
if (format == TextEditor::C_ADDED_LINE) { if (format == TextEditor::C_ADDED_LINE) {
// Mark trailing whitespace. // Mark trailing whitespace.
const int trimmedLen = trimmedLength(text); const int trimmedLen = trimmedLength(text);
setFormat(0, trimmedLen, formatForCategory(format)); setFormatWithSpaces(text, 0, trimmedLen, formatForCategory(format));
if (trimmedLen != length) if (trimmedLen != length)
setFormat(trimmedLen, length - trimmedLen, d->m_addedTrailingWhiteSpaceFormat); setFormat(trimmedLen, length - trimmedLen, d->m_addedTrailingWhiteSpaceFormat);
} else if (format != TextEditor::C_TEXT) { } else if (format != TextEditor::C_TEXT) {
setFormat(0, length, formatForCategory(format)); setFormatWithSpaces(text, 0, length, formatForCategory(format));
} else {
formatSpaces(text);
} }
// codefolding: // codefolding: