forked from qt-creator/qt-creator
Git: Allow colorful logs
Requires Git 2.3 or higher for RGB colors. Can be enabled for the normal or graph log with the "Color" tool button. For the diff log, the old behavior is kept (highlighter is used for the "normal" log, no colors at all for the graph log) Fixes: QTCREATORBUG-19624 Change-Id: I8a42a7ad0ebf99ceb459355310311d702dcf9977 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
3ddf93ba64
commit
cbb70513bf
@@ -38,6 +38,7 @@
|
||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <utils/ansiescapecodehandler.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/temporaryfile.h>
|
||||
|
||||
@@ -205,6 +206,20 @@ void GitEditorWidget::setPlainText(const QString &text)
|
||||
// If desired, filter out the date from annotation
|
||||
switch (contentType())
|
||||
{
|
||||
case LogOutput: {
|
||||
Utils::AnsiEscapeCodeHandler handler;
|
||||
const QList<Utils::FormattedText> formattedTextList
|
||||
= handler.parseText(Utils::FormattedText(text));
|
||||
|
||||
clear();
|
||||
QTextCursor cursor = textCursor();
|
||||
cursor.beginEditBlock();
|
||||
for (auto formattedChunk : formattedTextList)
|
||||
cursor.insertText(formattedChunk.text, formattedChunk.format);
|
||||
cursor.endEditBlock();
|
||||
|
||||
return;
|
||||
}
|
||||
case AnnotateOutput:
|
||||
modText = sanitizeBlameOutput(text);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user