diff --git a/mix/qml/html/cm/errorannotation.js b/mix/qml/html/cm/errorannotation.js
index 4da65ffa0..0830d2b9e 100644
--- a/mix/qml/html/cm/errorannotation.js
+++ b/mix/qml/html/cm/errorannotation.js
@@ -1,8 +1,8 @@
-function ErrorAnnotation(editor, line, col, content)
+function ErrorAnnotation(editor, line, column, content)
{
this.opened = false;
this.line = line;
- this.col = col;
+ this.column = column;
this.content = content;
this.editor = editor;
this.errorMark = null;
@@ -14,11 +14,11 @@ function ErrorAnnotation(editor, line, col, content)
ErrorAnnotation.prototype.init = function()
{
var separators = [' ', '\\\+', '-', ';', '\\\(', '\\\{', '\\\}', '\\\)', '\\*', '/', ':', '\\\?'];
- var errorPart = editor.getLine(this.line).substring(this.col);
- var incrMark = this.col + errorPart.split(new RegExp(separators.join('|'), 'g'))[0].length;
- if (incrMark === this.col)
- incrMark = this.col + 1;
- this.errorMark = editor.markText({ line: this.line, ch: this.col }, { line: this.line, ch: incrMark }, { className: "CodeMirror-errorannotation", inclusiveRight: true });
+ var errorPart = editor.getLine(this.line).substring(this.column);
+ var incrMark = this.column + errorPart.split(new RegExp(separators.join('|'), 'g'))[0].length;
+ if (incrMark === this.column)
+ incrMark = this.column + 1;
+ this.errorMark = editor.markText({ line: this.line, ch: this.column }, { line: this.line, ch: incrMark }, { className: "CodeMirror-errorannotation", inclusiveRight: true });
}
ErrorAnnotation.prototype.open = function()
@@ -26,7 +26,7 @@ ErrorAnnotation.prototype.open = function()
var node = document.createElement("div");
node.id = "annotation"
node.innerHTML = this.content;
- node.className = "CodeMirror-errorannotation-context"
+ node.className = "CodeMirror-errorannotation-context";
this.lineWidget = this.editor.addLineWidget(this.errorMark.find().from.line, node, { coverGutter: true });
this.opened = true;
}
@@ -37,7 +37,7 @@ ErrorAnnotation.prototype.close = function()
this.opened = false;
}
-ErrorAnnotation.prototype.detroy = function()
+ErrorAnnotation.prototype.destroy = function()
{
if (this.opened)
this.close();
diff --git a/mix/qml/html/cm/solarized.css b/mix/qml/html/cm/solarized.css
index 8a15b731f..0f4764c30 100644
--- a/mix/qml/html/cm/solarized.css
+++ b/mix/qml/html/cm/solarized.css
@@ -171,15 +171,15 @@ view-port
/* Error annotation */
.CodeMirror-errorannotation {
- background: rgb(255, 255, 170);
- color: red !important;
+ background: #b58900;
+ color: #dc322f !important;
}
.CodeMirror-errorannotation-context {
font-family: monospace;
font-size: small;
- color: red;
- background: rgb(255, 255, 170);
+ color: #dc322f;
+ background: #b58900;
padding: 2px;
}
diff --git a/mix/qml/html/codeeditor.js b/mix/qml/html/codeeditor.js
index a549d0e68..f42e62c94 100644
--- a/mix/qml/html/codeeditor.js
+++ b/mix/qml/html/codeeditor.js
@@ -148,8 +148,14 @@ compilationError = function(line, column, content)
line = line - 1;
if (column > 0)
column = column - 1;
+
if (annotation == null)
annotation = new ErrorAnnotation(editor, line, column, content);
+ else if (annotation.line !== line || annotation.column !== column || annotation.content !== content)
+ {
+ annotation.destroy();
+ annotation = new ErrorAnnotation(editor, line, column, content);
+ }
}, 500)
}
@@ -157,7 +163,7 @@ compilationComplete = function()
{
if (annotation !== null)
{
- annotation.detroy();
+ annotation.destroy();
annotation = null;
}
compilationCompleteBool = true;