summaryrefslogtreecommitdiff
path: root/src/plugins/pythoneditor/tools/pythonhighlighter.cpp
diff options
context:
space:
mode:
authorjkobus <jaroslaw.kobus@digia.com>2013-08-14 13:52:13 +0200
committerJarek Kobus <jaroslaw.kobus@digia.com>2013-08-29 08:54:04 +0200
commit33a7952745571576fb955fd33bc96e86f0e456fd (patch)
treee9eae74813d85ce1bcb75fbe73d9d4916ce62531 /src/plugins/pythoneditor/tools/pythonhighlighter.cpp
parenta06da47d5b74f9d680b2201e218c1df87f023faa (diff)
downloadqt-creator-33a7952745571576fb955fd33bc96e86f0e456fd.tar.gz
Implement syntax highlighting in diff editor
All Qt Creator's main highlighters are used in the first place, for other mimetypes generic highlighter is used as a fallback. Task-number: QTCREATORBUG-9580 Change-Id: I863b9085520e5bdda142ce88f2074afeacee0531 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
Diffstat (limited to 'src/plugins/pythoneditor/tools/pythonhighlighter.cpp')
-rw-r--r--src/plugins/pythoneditor/tools/pythonhighlighter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/pythoneditor/tools/pythonhighlighter.cpp b/src/plugins/pythoneditor/tools/pythonhighlighter.cpp
index ea809c4e6f..32c59ef6b0 100644
--- a/src/plugins/pythoneditor/tools/pythonhighlighter.cpp
+++ b/src/plugins/pythoneditor/tools/pythonhighlighter.cpp
@@ -65,10 +65,21 @@ using namespace PythonEditor::Internal;
* @endcode
*/
+PythonHighlighter::PythonHighlighter(QTextDocument *parent) :
+ TextEditor::SyntaxHighlighter(parent)
+{
+ init();
+}
+
/// New instance created when opening any document in editor
PythonHighlighter::PythonHighlighter(TextEditor::BaseTextDocument *parent) :
TextEditor::SyntaxHighlighter(parent)
{
+ init();
+}
+
+void PythonHighlighter::init()
+{
static QVector<TextEditor::TextStyle> categories;
if (categories.isEmpty()) {
categories << TextEditor::C_NUMBER