diff --git a/scripts/wt-mode.el b/scripts/wt-mode.el index caf9679..58f9633 100644 --- a/scripts/wt-mode.el +++ b/scripts/wt-mode.el @@ -25,7 +25,7 @@ ;; echo $(webrunner -h | sed -n 's, COMMAND: ,,p') | sed 's, ,\\\\|,g' (defconst wt-font-lock-keywords (list - '("^ *\\(ca-certificate\\|call\\|case\\|check\\|clear-cookies\\|click\\|clicktype\\|client-certificate\\|do\\|download\\|echo\\|execute\\|exists\\|exit\\|expect\\|fail\\|for\\|function\\|if\\|ignoreto\\|include\\|label\\|load\\|not\\|offline-storage-path\\|open\\|screenshot\\|set\\|setvalue\\|sleep\\|testcase\\|testsuite\\|timeout\\|unset\\|upload\\) " . font-lock-builtin-face) + '("^ *\\(auth\\|ca-certificate\\|call\\|case\\|check\\|clear-cookies\\|click\\|clicktype\\|client-certificate\\|do\\|download\\|echo\\|execute\\|exists\\|exit\\|expect\\|fail\\|for\\|function\\|if\\|ignoreto\\|include\\|label\\|load\\|not\\|offline-storage-path\\|open\\|screenshot\\|set\\|setvalue\\|sleep\\|testcase\\|testsuite\\|timeout\\|unset\\|upload\\) " . font-lock-builtin-face) '("^ *#.*$" . font-lock-comment-face)) "Highlighting expressions for Webtester") diff --git a/src/editor.hxx b/src/editor.hxx index 4baaac4..d6dd619 100644 --- a/src/editor.hxx +++ b/src/editor.hxx @@ -6,6 +6,38 @@ #include #include #include +#include +#include +#include + +class Highlighter: public QSyntaxHighlighter { + Q_OBJECT; + public: + Highlighter(QTextDocument *parent): QSyntaxHighlighter(parent) { + QString commands="auth|ca-certificate|call|case|check|clear-cookies|click|clicktype|client-certificate|do|download|echo|execute|exists|exit|expect|fail|for|function|if|ignoreto|include|label|load|not|offline-storage-path|open|screenshot|set|setvalue|sleep|testcase|testsuite|timeout|unset|upload"; + _expressions< _expressions; +}; class CodeEditor; @@ -23,6 +55,7 @@ class CodeEditor: public QPlainTextEdit { Q_OBJECT; public: CodeEditor(QWidget *parent = 0): QPlainTextEdit(parent) { + new Highlighter(document()); lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));