Merge pull request #1033 from ajaxorg/annotations

allow multiline annotations
This commit is contained in:
Lennart Kats 2012-10-15 06:22:14 -07:00
commit 8ed09f246a
4 changed files with 15 additions and 3 deletions

View file

@ -242,6 +242,8 @@
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
white-space: pre-line;
word-wrap: break-word;
}
.ace_folding-enabled > .ace_gutter-cell {

View file

@ -33,6 +33,7 @@ define(function(require, exports, module) {
var dom = require("../lib/dom");
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var EventEmitter = require("../lib/event_emitter").EventEmitter;
var Gutter = function(parentEl) {
@ -78,12 +79,15 @@ var Gutter = function(parentEl) {
var annotation = annotations[i];
var row = annotation.row;
var rowInfo = this.$annotations[row];
if (!rowInfo) {
if (!rowInfo)
rowInfo = this.$annotations[row] = {text: []};
}
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</g, "&lt;");
var annoText = annotation.text;
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText);
var type = annotation.type;
if (type == "error")
rowInfo.className = " ace_error";

View file

@ -117,6 +117,10 @@ exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
exports.escapeHTML = function(str) {
return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
};
exports.getMatchOffsets = function(string, regExp) {
var matches = [];

View file

@ -143,6 +143,8 @@ oop.inherits(JavaScriptWorker, Mirror);
if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
error.reason = 'Missing ";" before statement';
type = "error";
} else {
type = "info";
}
}
else if (disabledWarningsRe.test(raw)) {