diff --git a/share/qtcreator/styles/dark.xml b/share/qtcreator/styles/dark.xml
index 9bdf0312864..f9213d1b617 100644
--- a/share/qtcreator/styles/dark.xml
+++ b/share/qtcreator/styles/dark.xml
@@ -52,4 +52,5 @@
+
diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml
index adc8ec08ca1..df856488878 100644
--- a/share/qtcreator/styles/inkpot.xml
+++ b/share/qtcreator/styles/inkpot.xml
@@ -60,5 +60,6 @@
+
diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp
index d1796ea76aa..ae67b142449 100644
--- a/src/plugins/texteditor/texteditorconstants.cpp
+++ b/src/plugins/texteditor/texteditorconstants.cpp
@@ -96,6 +96,8 @@ const char *nameForStyle(TextStyle style)
case C_DIFF_DEST_LINE: return "DiffDestLine";
case C_DIFF_DEST_CHAR: return "DiffDestChar";
+ case C_LOG_CHANGE_LINE: return "LogChangeLine";
+
case C_LAST_STYLE_SENTINEL: return "LastStyleSentinel";
}
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index 3bdf5c2b2ca..1ae715db522 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -95,6 +95,8 @@ enum TextStyle {
C_DIFF_DEST_LINE,
C_DIFF_DEST_CHAR,
+ C_LOG_CHANGE_LINE,
+
C_LAST_STYLE_SENTINEL
};
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index fd3bf12b1c0..59bfeff9dea 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -268,6 +268,10 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
"in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(175, 255, 175))));
+ formatDescr.append(FormatDescription(C_LOG_CHANGE_LINE, tr("Log Change Line"),
+ tr("Applied to lines describing changes in VCS log"),
+ Format(QColor(192, 0, 0), QColor())));
+
d->m_fontSettingsPage = new FontSettingsPage(formatDescr,
Constants::TEXT_EDITOR_FONT_SETTINGS,
this);
diff --git a/src/plugins/vcsbase/diffandloghighlighter.cpp b/src/plugins/vcsbase/diffandloghighlighter.cpp
index f2491cbdebb..f1f1b857c88 100644
--- a/src/plugins/vcsbase/diffandloghighlighter.cpp
+++ b/src/plugins/vcsbase/diffandloghighlighter.cpp
@@ -56,6 +56,12 @@
@@ -10,6 +10,7 @@ SUBDIRS = plugin_coreplugin
\endcode
+ Log is parametrizable by change indicator. For example '^commit ([0-9a-f]{8})[0-9a-f]{32}'
+ in Git:
+ \code
+ commit a3398841a24b24c73b47759c4bffdc8b78a34936 (HEAD, master)
+ \code
+
Also highlights trailing blanks.
*/
@@ -72,7 +78,8 @@ enum DiffFormats {
DiffInFormat,
DiffOutFormat,
DiffFileFormat,
- DiffLocationFormat
+ DiffLocationFormat,
+ ChangeTextFormat
};
enum FoldingState {
@@ -98,12 +105,13 @@ class DiffAndLogHighlighterPrivate
DiffAndLogHighlighter *q_ptr;
Q_DECLARE_PUBLIC(DiffAndLogHighlighter)
public:
- DiffAndLogHighlighterPrivate(const QRegExp &filePattern);
+ DiffAndLogHighlighterPrivate(const QRegExp &filePattern, const QRegExp &changePattern);
Internal::DiffFormats analyzeLine(const QString &block) const;
void updateOtherFormats();
mutable QRegExp m_filePattern;
+ mutable QRegExp m_changePattern;
const QString m_locationIndicator;
const QChar m_diffInIndicator;
const QChar m_diffOutIndicator;
@@ -112,9 +120,10 @@ public:
Internal::FoldingState m_foldingState;
};
-DiffAndLogHighlighterPrivate::DiffAndLogHighlighterPrivate(const QRegExp &filePattern) :
+DiffAndLogHighlighterPrivate::DiffAndLogHighlighterPrivate(const QRegExp &filePattern, const QRegExp &changePattern) :
q_ptr(0),
m_filePattern(filePattern),
+ m_changePattern(changePattern),
m_locationIndicator(QLatin1String("@@")),
m_diffInIndicator(QLatin1Char('+')),
m_diffOutIndicator(QLatin1Char('-')),
@@ -129,6 +138,8 @@ Internal::DiffFormats DiffAndLogHighlighterPrivate::analyzeLine(const QString &t
// file first
if (m_filePattern.indexIn(text) == 0)
return Internal::DiffFileFormat;
+ if (m_changePattern.indexIn(text) == 0)
+ return Internal::ChangeTextFormat;
if (text.startsWith(m_diffInIndicator))
return Internal::DiffInFormat;
if (text.startsWith(m_diffOutIndicator))
@@ -147,9 +158,9 @@ void DiffAndLogHighlighterPrivate::updateOtherFormats()
}
// --- DiffAndLogHighlighter
-DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern) :
+DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern, const QRegExp &changePattern) :
TextEditor::SyntaxHighlighter(static_cast(0)),
- d_ptr(new DiffAndLogHighlighterPrivate(filePattern))
+ d_ptr(new DiffAndLogHighlighterPrivate(filePattern, changePattern))
{
d_ptr->q_ptr = this;
Q_D(DiffAndLogHighlighter);
@@ -160,7 +171,8 @@ DiffAndLogHighlighter::DiffAndLogHighlighter(const QRegExp &filePattern) :
<< TextEditor::C_ADDED_LINE
<< TextEditor::C_REMOVED_LINE
<< TextEditor::C_DIFF_FILE
- << TextEditor::C_DIFF_LOCATION;
+ << TextEditor::C_DIFF_LOCATION
+ << TextEditor::C_LOG_CHANGE_LINE;
}
setTextFormatCategories(categories);
d->updateOtherFormats();
diff --git a/src/plugins/vcsbase/diffandloghighlighter.h b/src/plugins/vcsbase/diffandloghighlighter.h
index 801b75ea2cd..7406a91f4c9 100644
--- a/src/plugins/vcsbase/diffandloghighlighter.h
+++ b/src/plugins/vcsbase/diffandloghighlighter.h
@@ -52,7 +52,7 @@ class VCSBASE_EXPORT DiffAndLogHighlighter : public TextEditor::SyntaxHighlighte
Q_OBJECT
Q_DECLARE_PRIVATE(DiffAndLogHighlighter)
public:
- explicit DiffAndLogHighlighter(const QRegExp &filePattern);
+ explicit DiffAndLogHighlighter(const QRegExp &filePattern, const QRegExp &changePattern);
~DiffAndLogHighlighter();
void highlightBlock(const QString &text);
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index fcfaa7976bb..f023a18599c 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -736,7 +736,7 @@ void VcsBaseEditorWidget::init()
break;
}
if (hasDiff()) {
- auto dh = new DiffAndLogHighlighter(d->m_diffFilePattern);
+ auto dh = new DiffAndLogHighlighter(d->m_diffFilePattern, d->m_logEntryPattern);
setCodeFoldingSupported(true);
textDocument()->setSyntaxHighlighter(dh);
}