Skip to content
Browse files

update ace++

  • Loading branch information...
1 parent ce69ff0 commit 60ce76164b7acc0750916ca7a3128dceedd37e15 @nightwing nightwing committed Jan 1, 2012
View
1,146 chrome/content/ace++/res/ace/ace-uncompressed.js
@@ -177,8 +177,17 @@ var Editor = function(renderer, session) {
this.renderer.unsetStyle(style);
};
- this.setFontSize = function(size) {
+ this.setFontSize = function(size, delta) {
+ if (delta && !size)
+ size = (parseInt(this.container.style.fontSize) || 12) + delta;
+ else if (!size)
+ size = 12;
+
+ if (typeof size == "number")
+ size = size + "px";
+
this.container.style.fontSize = size;
+ this.renderer.updateFontSize();
};
this.$highlightBrackets = function() {
@@ -1167,8 +1176,7 @@ var Editor = function(renderer, session) {
var range = this.$search.find(this.session);
if (range) {
this.session.unfold(range);
- this.gotoLine(range.end.row+1, range.end.column);
- this.selection.setSelectionRange(range);
+ this.selection.setSelectionRange(range); // this scrolls selection into view
}
};
@@ -1832,12 +1840,8 @@ var VirtualRenderer = function(container, theme) {
};
this.scrollToLine = function(line, center) {
- var lineHeight = { lineHeight: this.lineHeight };
- var offset = 0;
- for (var l = 1; l < line; l++) {
- offset += this.session.getRowHeight(lineHeight, l-1);
- }
-
+ var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
+ var offset = pos.top
if (center) {
offset -= this.$size.scrollerHeight / 2;
}
@@ -5369,12 +5373,12 @@ exports.commands = [{
readOnly: true
}, {
name: "centerselection",
- bindKey: bindKey(null, "Ctrl-L"),
+ bindKey: bindKey("Ctrl-L", "Ctrl-L"),
exec: function(editor) { editor.centerSelection(); },
readOnly: true
}, {
name: "gotoline",
- bindKey: bindKey("Ctrl-L", "Command-L"),
+ bindKey: bindKey("Ctrl-R", "Command-L"),
exec: function(editor) {
var line = parseInt(prompt("Enter line number:"), 10);
if (!isNaN(line)) {
@@ -5403,16 +5407,31 @@ exports.commands = [{
exec: function(editor) { editor.session.unfold(); },
readOnly: true
}, {
+ name: "selectWord",
+ bindKey: bindKey("Ctrl-W", ""),
+ exec: function(editor) { editor.selection.selectWord(); },
+ readOnly: true
+}, , {
name: "findnext",
- bindKey: bindKey("Ctrl-K", "Command-G"),
+ bindKey: bindKey("Ctrl-R", "Command-G"),
exec: function(editor) { editor.findNext(); },
readOnly: true
}, {
name: "findprevious",
- bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
+ bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-G"),
exec: function(editor) { editor.findPrevious(); },
readOnly: true
}, {
+ name: "selectAndFindnext",
+ bindKey: bindKey("Ctrl-K", ""),
+ exec: function(editor) { editor.selection.selectWord(); editor.findNext(); },
+ readOnly: true
+}, {
+ name: "selectAndFfindprevious",
+ bindKey: bindKey("Ctrl-Shift-K", ""),
+ exec: function(editor) { editor.selection.selectWord(); editor.findPrevious(); },
+ readOnly: true
+}, {
name: "find",
bindKey: bindKey("Ctrl-F", "Command-F"),
exec: function(editor) {
@@ -5427,12 +5446,12 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttostart",
- bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
+ bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
readOnly: true
}, {
name: "gotostart",
- bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
+ bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
readOnly: true
}, {
@@ -5447,12 +5466,12 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttoend",
- bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
+ bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
readOnly: true
}, {
name: "gotoend",
- bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
+ bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
readOnly: true
}, {
@@ -5575,6 +5594,21 @@ exports.commands = [{
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
exec: function(editor) { editor.commands.replay(editor); },
readOnly: true
+}, {
+ name: "fontsize++",
+ bindKey: bindKey("Ctrl-+", "Command-+"),
+ exec: function(editor) { editor.setFontSize(null, +1) },
+ readOnly: true
+}, {
+ name: "fontsize--",
+ bindKey: bindKey("Ctrl--", "Command--"),
+ exec: function(editor) { editor.setFontSize(null, -1) },
+ readOnly: true
+}, {
+ name: "fontsizetodefault",
+ bindKey: bindKey("Ctrl-NUMPAD0|Ctrl-0", "Command-Numpad0|Command-0"),
+ exec: function(editor) { editor.setFontSize(null) },
+ readOnly: true
},
// commands disabled in readOnly mode
@@ -5588,7 +5622,7 @@ exports.commands = [{
exec: function(editor) { editor.toggleCommentLines(); }
}, {
name: "replace",
- bindKey: bindKey("Ctrl-R", "Command-Option-F"),
+ bindKey: bindKey("Ctrl-H", "Command-Option-F"),
exec: function(editor) {
var needle = prompt("Find:", editor.getCopyText());
if (!needle)
@@ -5600,7 +5634,7 @@ exports.commands = [{
}
}, {
name: "replaceall",
- bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
+ bindKey: bindKey("Ctrl-Shift-H", "Command-Shift-Option-F"),
exec: function(editor) {
var needle = prompt("Find:");
if (!needle)
@@ -5957,280 +5991,589 @@ exports.getParentWindow = function(document) {
});
-define("ace/layer/gutter",[], function(require, exports, module) {
+define("ace/lib/event",[], function(require, exports, module) {
+var keys = require("ace/lib/keys");
+var useragent = require("ace/lib/useragent");
var dom = require("ace/lib/dom");
-var oop = require("ace/lib/oop");
-var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
-var Gutter = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_gutter-layer";
- parentEl.appendChild(this.element);
- this.setShowFoldWidgets(this.$showFoldWidgets);
-
- this.gutterWidth = 0;
+exports.addListener = function(elem, type, callback) {
+ if (elem.addEventListener) {
+ return elem.addEventListener(type, callback, false);
+ }
+ if (elem.attachEvent) {
+ var wrapper = function() {
+ callback(window.event);
+ };
+ callback._wrapper = wrapper;
+ elem.attachEvent("on" + type, wrapper);
+ }
+};
- this.$breakpoints = [];
- this.$annotations = [];
- this.$decorations = [];
+exports.removeListener = function(elem, type, callback) {
+ if (elem.removeEventListener) {
+ return elem.removeEventListener(type, callback, false);
+ }
+ if (elem.detachEvent) {
+ elem.detachEvent("on" + type, callback._wrapper || callback);
+ }
};
-(function() {
+/**
+* Prevents propagation and clobbers the default action of the passed event
+*/
+exports.stopEvent = function(e) {
+ exports.stopPropagation(e);
+ exports.preventDefault(e);
+ return false;
+};
- oop.implement(this, EventEmitter);
-
- this.setSession = function(session) {
- this.session = session;
- };
+exports.stopPropagation = function(e) {
+ if (e.stopPropagation)
+ e.stopPropagation();
+ else
+ e.cancelBubble = true;
+};
- this.addGutterDecoration = function(row, className){
- if (!this.$decorations[row])
- this.$decorations[row] = "";
- this.$decorations[row] += " ace_" + className;
- };
+exports.preventDefault = function(e) {
+ if (e.preventDefault)
+ e.preventDefault();
+ else
+ e.returnValue = false;
+};
- this.removeGutterDecoration = function(row, className){
- this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
- };
+exports.getDocumentX = function(e) {
+ if (e.clientX) {
+ return e.clientX + dom.getPageScrollLeft();
+ } else {
+ return e.pageX;
+ }
+};
- this.setBreakpoints = function(rows) {
- };
+exports.getDocumentY = function(e) {
+ if (e.clientY) {
+ return e.clientY + dom.getPageScrollTop();
+ } else {
+ return e.pageY;
+ }
+};
- this.setAnnotations = function(annotations) {
- // iterate over sparse array
- this.$annotations = [];
- for (var row in annotations) if (annotations.hasOwnProperty(row)) {
- var rowAnnotations = annotations[row];
- if (!rowAnnotations)
- continue;
+/**
+ * @return {Number} 0 for left button, 1 for middle button, 2 for right button
+ */
+exports.getButton = function(e) {
+ if (e.type == "dblclick")
+ return 0;
+ else if (e.type == "contextmenu")
+ return 2;
- var rowInfo = this.$annotations[row] = {
- text: []
- };
- for (var i=0; i<rowAnnotations.length; i++) {
- var annotation = rowAnnotations[i];
- var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;");
- if (rowInfo.text.indexOf(annoText) === -1)
- rowInfo.text.push(annoText);
- var type = annotation.type;
- if (type == "error")
- rowInfo.className = "ace_error";
- else if (type == "warning" && rowInfo.className != "ace_error")
- rowInfo.className = "ace_warning";
- else if (type == "info" && (!rowInfo.className))
- rowInfo.className = "ace_info";
- }
- }
- };
+ // DOM Event
+ if (e.preventDefault) {
+ return e.button;
+ }
+ // old IE
+ else {
+ return {1:0, 2:2, 4:1}[e.button];
+ }
+};
- this.update = function(config) {
- this.$config = config;
+if (document.documentElement.setCapture) {
+ exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+ function onMouseMove(e) {
+ eventHandler(e);
+ return exports.stopPropagation(e);
+ }
- var emptyAnno = {className: "", text: []};
- var breakpoints = this.session.$breakpoints;
- var html = [];
- var i = config.firstRow;
- var lastRow = config.lastRow;
- var fold = this.session.getNextFoldLine(i);
- var foldStart = fold ? fold.start.row : Infinity;
- var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
+ var called = false;
+ function onReleaseCapture(e) {
+ eventHandler(e);
- while (true) {
- if(i > foldStart) {
- i = fold.end.row + 1;
- fold = this.session.getNextFoldLine(i, fold);
- foldStart = fold ?fold.start.row :Infinity;
+ if (!called) {
+ called = true;
+ releaseCaptureHandler(e);
}
- if(i > lastRow)
- break;
- var annotation = this.$annotations[i] || emptyAnno;
- html.push("<div class='ace_gutter-cell",
- this.$decorations[i] || "",
- breakpoints[i] ? " ace_breakpoint " + breakpoints[i] : " ",
- annotation.className,
- "' title='", annotation.text.join("\n"),
- "' style='height:", config.lineHeight, "px;'>", i);
+ exports.removeListener(el, "mousemove", eventHandler);
+ exports.removeListener(el, "mouseup", onReleaseCapture);
+ exports.removeListener(el, "losecapture", onReleaseCapture);
- if (foldWidgets) {
- var c = foldWidgets[i];
- // check if cached value is invalidated and we need to recompute
- if (c == null)
- c = foldWidgets[i] = this.session.getFoldWidget(i);
- if (c)
- html.push(
- "<span class='ace_fold-widget ", c,
- c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
- "'></span>"
- );
- }
+ el.releaseCapture();
+ }
- var wrappedRowLength = this.session.getRowLength(i) - 1;
- while (wrappedRowLength--) {
- html.push("</div><div class='ace_gutter-cell' style='height:", config.lineHeight, "px'>&#166;");
- }
+ exports.addListener(el, "mousemove", eventHandler);
+ exports.addListener(el, "mouseup", onReleaseCapture);
+ exports.addListener(el, "losecapture", onReleaseCapture);
+ el.setCapture();
+ };
+}
+else {
+ exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+ function onMouseMove(e) {
+ eventHandler(e);
+ e.stopPropagation();
+ }
- html.push("</div>");
+ function onMouseUp(e) {
+ eventHandler && eventHandler(e);
+ releaseCaptureHandler && releaseCaptureHandler(e);
- i++;
- }
-
- html.push(
- "</div><div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
- this.session.getLength() - 1,
- "</div>"
- );
- this.element = dom.setInnerHtml(this.element, html.join(""));
- this.element.style.height = config.minHeight + "px";
-
- var gutterWidth = this.element.offsetWidth;
- if (gutterWidth !== this.gutterWidth) {
- this.gutterWidth = gutterWidth;
- this._emit("changeGutterWidth", gutterWidth);
- }
- };
+ document.removeEventListener("mousemove", onMouseMove, true);
+ document.removeEventListener("mouseup", onMouseUp, true);
- this.$showFoldWidgets = true;
- this.setShowFoldWidgets = function(show) {
- if (show)
- dom.addCssClass(this.element, "ace_folding-enabled");
- else
- dom.removeCssClass(this.element, "ace_folding-enabled");
+ e.stopPropagation();
+ }
- this.$showFoldWidgets = show;
- };
-
- this.getShowFoldWidgets = function() {
- return this.$showFoldWidgets;
+ document.addEventListener("mousemove", onMouseMove, true);
+ document.addEventListener("mouseup", onMouseUp, true);
};
+}
-}).call(Gutter.prototype);
+exports.addMouseWheelListener = function(el, callback) {
+ var max = 0;
+ var listener = function(e) {
+ if (e.wheelDelta !== undefined) {
-exports.Gutter = Gutter;
+ // some versions of Safari (e.g. 5.0.5) report insanely high
+ // scroll values. These browsers require a higher factor
+ if (Math.abs(e.wheelDeltaY) > max)
+ max = Math.abs(e.wheelDeltaY);
-});
+ if (max > 5000)
+ var factor = 400;
+ else
+ var factor = 8;
-define("ace/layer/marker",[], function(require, exports, module) {
+ if (e.wheelDeltaX !== undefined) {
+ e.wheelX = -e.wheelDeltaX / factor;
+ e.wheelY = -e.wheelDeltaY / factor;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = -e.wheelDelta / factor;
+ }
+ }
+ else {
+ if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
+ e.wheelX = (e.detail || 0) * 5;
+ e.wheelY = 0;
+ } else {
+ e.wheelX = 0;
+ e.wheelY = (e.detail || 0) * 5;
+ }
+ }
+ callback(e);
+ };
+ exports.addListener(el, "DOMMouseScroll", listener);
+ exports.addListener(el, "mousewheel", listener);
+};
-var Range = require("ace/range").Range;
-var dom = require("ace/lib/dom");
+exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
+ var clicks = 0;
+ var startX, startY;
-var Marker = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_marker-layer";
- parentEl.appendChild(this.element);
-};
+ var listener = function(e) {
+ clicks += 1;
+ if (clicks == 1) {
+ startX = e.clientX;
+ startY = e.clientY;
-(function() {
+ setTimeout(function() {
+ clicks = 0;
+ }, timeout || 600);
+ }
- this.$padding = 0;
+ var isButton = exports.getButton(e) == button;
+ if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
+ clicks = 0;
- this.setPadding = function(padding) {
- this.$padding = padding;
- };
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.setMarkers = function(markers) {
- this.markers = markers;
+ if (clicks == count) {
+ clicks = 0;
+ callback(e);
+ }
+
+ if (isButton)
+ return exports.preventDefault(e);
};
- this.update = function(config) {
- var config = config || this.config;
- if (!config)
- return;
+ exports.addListener(el, "mousedown", listener);
+ useragent.isOldIE && exports.addListener(el, "dblclick", listener);
+};
- this.config = config;
+function normalizeCommandKeys(callback, e, keyCode) {
+ var hashId = 0;
+ if (useragent.isOpera && useragent.isMac) {
+ hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
+ | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
+ } else {
+ hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
+ | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
+ }
+ if (keyCode in keys.MODIFIER_KEYS) {
+ switch (keys.MODIFIER_KEYS[keyCode]) {
+ case "Alt":
+ hashId = 2;
+ break;
+ case "Shift":
+ hashId = 4;
+ break;
+ case "Ctrl":
+ hashId = 1;
+ break;
+ default:
+ hashId = 8;
+ break;
+ }
+ keyCode = 0;
+ }
- var html = [];
- for ( var key in this.markers) {
- var marker = this.markers[key];
+ if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
+ keyCode = 0;
+ }
- var range = marker.range.clipRows(config.firstRow, config.lastRow);
- if (range.isEmpty()) continue;
+ // If there is no hashID and the keyCode is not a function key, then
+ // we don't call the callback as we don't handle a command key here
+ // (it's a normal key/character input).
+ if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
+ return false;
+ }
+ return callback(e, hashId, keyCode);
+}
- range = range.toScreenRange(this.session);
- if (marker.renderer) {
- var top = this.$getTop(range.start.row, config);
- var left = Math.round(
- this.$padding + range.start.column * config.characterWidth
- );
- marker.renderer(html, range, left, top, config);
- }
- else if (range.isMultiLine()) {
- if (marker.type == "text") {
- this.drawTextMarker(html, range, marker.clazz, config);
+exports.addCommandKeyListener = function(el, callback) {
+ var addListener = exports.addListener;
+ if (useragent.isOldGecko) {
+ // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
+ // event if the user pressed the key for a longer time. Instead, the
+ // keydown event was fired once and later on only the keypress event.
+ // To emulate the 'right' keydown behavior, the keyCode of the initial
+ // keyDown event is stored and in the following keypress events the
+ // stores keyCode is used to emulate a keyDown event.
+ var lastKeyDownKeyCode = null;
+ addListener(el, "keydown", function(e) {
+ lastKeyDownKeyCode = e.keyCode;
+ });
+ addListener(el, "keypress", function(e) {
+ return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
+ });
+ } else {
+ var lastDown = null;
+
+ addListener(el, "keydown", function(e) {
+ lastDown = e.keyIdentifier || e.keyCode;
+ return normalizeCommandKeys(callback, e, e.keyCode);
+ });
+
+ // repeated keys are fired as keypress and not keydown events
+ if (useragent.isMac && useragent.isOpera) {
+ addListener(el, "keypress", function(e) {
+ var keyId = e.keyIdentifier || e.keyCode;
+ if (lastDown !== keyId) {
+ return normalizeCommandKeys(callback, e, lastDown);
} else {
- this.drawMultiLineMarker(
- html, range, marker.clazz, config,
- marker.type
- );
+ lastDown = null;
}
- }
- else {
- this.drawSingleLineMarker(
- html, range, marker.clazz, config,
- null, marker.type
- );
- }
+ });
}
- this.element = dom.setInnerHtml(this.element, html.join(""));
- };
+ }
+};
- this.$getTop = function(row, layerConfig) {
- return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
+if (window.postMessage) {
+ var postMessageId = 1;
+ exports.nextTick = function(callback, win) {
+ win = win || window;
+ var messageName = "zero-timeout-message-" + postMessageId;
+ exports.addListener(win, "message", function listener(e) {
+ if (e.data == messageName) {
+ exports.stopPropagation(e);
+ exports.removeListener(win, "message", listener);
+ callback();
+ }
+ });
+ win.postMessage(messageName, "*");
+ };
+}
+else {
+ exports.nextTick = function(callback, win) {
+ win = win || window;
+ window.setTimeout(callback, 0);
};
+}
- /**
- * Draws a marker, which spans a range of text in a single line
- */
- this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
- // selection start
- var row = range.start.row;
+});
- var lineRange = new Range(
- row, range.start.column,
- row, this.session.getScreenLastRowColumn(row)
- );
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
+define("ace/layer/gutter",[], function(require, exports, module) {
- // selection end
- row = range.end.row;
- lineRange = new Range(row, 0, row, range.end.column);
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, "text");
+var dom = require("ace/lib/dom");
+var oop = require("ace/lib/oop");
+var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
- for (row = range.start.row + 1; row < range.end.row; row++) {
- lineRange.start.row = row;
- lineRange.end.row = row;
- lineRange.end.column = this.session.getScreenLastRowColumn(row);
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
- }
- };
+var Gutter = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_gutter-layer";
+ parentEl.appendChild(this.element);
+ this.setShowFoldWidgets(this.$showFoldWidgets);
+
+ this.gutterWidth = 0;
- /**
- * Draws a multi line marker, where lines span the full width
- */
- this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
- var padding = type === "background" ? 0 : this.$padding;
- var layerWidth = layerConfig.width + 2 * this.$padding - padding;
- // from selection start to the end of the line
- var height = layerConfig.lineHeight;
- var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
- var top = this.$getTop(range.start.row, layerConfig);
- var left = Math.round(
- padding + range.start.column * layerConfig.characterWidth
- );
+ this.$breakpoints = [];
+ this.$annotations = [];
+ this.$decorations = [];
+};
- stringBuilder.push(
- "<div class='", clazz, "' style='",
- "height:", height, "px;",
- "width:", width, "px;",
- "top:", top, "px;",
- "left:", left, "px;'></div>"
- );
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.addGutterDecoration = function(row, className){
+ if (!this.$decorations[row])
+ this.$decorations[row] = "";
+ this.$decorations[row] += " ace_" + className;
+ };
+
+ this.removeGutterDecoration = function(row, className){
+ this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
+ };
+
+ this.setBreakpoints = function(rows) {
+ };
+
+ this.setAnnotations = function(annotations) {
+ // iterate over sparse array
+ this.$annotations = [];
+ for (var row in annotations) if (annotations.hasOwnProperty(row)) {
+ var rowAnnotations = annotations[row];
+ if (!rowAnnotations)
+ continue;
+
+ var rowInfo = this.$annotations[row] = {
+ text: []
+ };
+ for (var i=0; i<rowAnnotations.length; i++) {
+ var annotation = rowAnnotations[i];
+ var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;");
+ if (rowInfo.text.indexOf(annoText) === -1)
+ rowInfo.text.push(annoText);
+ var type = annotation.type;
+ if (type == "error")
+ rowInfo.className = "ace_error";
+ else if (type == "warning" && rowInfo.className != "ace_error")
+ rowInfo.className = "ace_warning";
+ else if (type == "info" && (!rowInfo.className))
+ rowInfo.className = "ace_info";
+ }
+ }
+ };
+
+ this.update = function(config) {
+ this.$config = config;
+
+ var emptyAnno = {className: "", text: []};
+ var breakpoints = this.session.$breakpoints;
+ var html = [];
+ var i = config.firstRow;
+ var lastRow = config.lastRow;
+ var fold = this.session.getNextFoldLine(i);
+ var foldStart = fold ? fold.start.row : Infinity;
+ var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
+
+ while (true) {
+ if(i > foldStart) {
+ i = fold.end.row + 1;
+ fold = this.session.getNextFoldLine(i, fold);
+ foldStart = fold ?fold.start.row :Infinity;
+ }
+ if(i > lastRow)
+ break;
+
+ var annotation = this.$annotations[i] || emptyAnno;
+ html.push("<div class='ace_gutter-cell",
+ this.$decorations[i] || "",
+ breakpoints[i] ? " ace_breakpoint " + breakpoints[i] : " ",
+ annotation.className,
+ "' title='", annotation.text.join("\n"),
+ "' style='height:", config.lineHeight, "px;'>", i);
+
+ if (foldWidgets) {
+ var c = foldWidgets[i];
+ // check if cached value is invalidated and we need to recompute
+ if (c == null)
+ c = foldWidgets[i] = this.session.getFoldWidget(i);
+ if (c)
+ html.push(
+ "<span class='ace_fold-widget ", c,
+ c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
+ "'></span>"
+ );
+ }
+
+ var wrappedRowLength = this.session.getRowLength(i) - 1;
+ while (wrappedRowLength--) {
+ html.push("</div><div class='ace_gutter-cell' style='height:", config.lineHeight, "px'>&#166;");
+ }
+
+ html.push("</div>");
+
+ i++;
+ }
+ html.push(
+ "</div><div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
+ this.session.getLength() - 1,
+ "</div>"
+ );
+ this.element = dom.setInnerHtml(this.element, html.join(""));
+ this.element.style.height = config.minHeight + "px";
+
+ var gutterWidth = this.element.offsetWidth;
+ if (gutterWidth !== this.gutterWidth) {
+ this.gutterWidth = gutterWidth;
+ this._emit("changeGutterWidth", gutterWidth);
+ }
+ };
+
+ this.$showFoldWidgets = true;
+ this.setShowFoldWidgets = function(show) {
+ if (show)
+ dom.addCssClass(this.element, "ace_folding-enabled");
+ else
+ dom.removeCssClass(this.element, "ace_folding-enabled");
+
+ this.$showFoldWidgets = show;
+ };
+
+ this.getShowFoldWidgets = function() {
+ return this.$showFoldWidgets;
+ };
+
+}).call(Gutter.prototype);
+
+exports.Gutter = Gutter;
+
+});
+
+define("ace/layer/marker",[], function(require, exports, module) {
+
+var Range = require("ace/range").Range;
+var dom = require("ace/lib/dom");
+
+var Marker = function(parentEl) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_layer ace_marker-layer";
+ parentEl.appendChild(this.element);
+};
+
+(function() {
+
+ this.$padding = 0;
+
+ this.setPadding = function(padding) {
+ this.$padding = padding;
+ };
+ this.setSession = function(session) {
+ this.session = session;
+ };
+
+ this.setMarkers = function(markers) {
+ this.markers = markers;
+ };
+
+ this.update = function(config) {
+ var config = config || this.config;
+ if (!config)
+ return;
+
+ this.config = config;
+
+
+ var html = [];
+ for ( var key in this.markers) {
+ var marker = this.markers[key];
+
+ var range = marker.range.clipRows(config.firstRow, config.lastRow);
+ if (range.isEmpty()) continue;
+
+ range = range.toScreenRange(this.session);
+ if (marker.renderer) {
+ var top = this.$getTop(range.start.row, config);
+ var left = Math.round(
+ this.$padding + range.start.column * config.characterWidth
+ );
+ marker.renderer(html, range, left, top, config);
+ }
+ else if (range.isMultiLine()) {
+ if (marker.type == "text") {
+ this.drawTextMarker(html, range, marker.clazz, config);
+ } else {
+ this.drawMultiLineMarker(
+ html, range, marker.clazz, config,
+ marker.type
+ );
+ }
+ }
+ else {
+ this.drawSingleLineMarker(
+ html, range, marker.clazz, config,
+ null, marker.type
+ );
+ }
+ }
+ this.element = dom.setInnerHtml(this.element, html.join(""));
+ };
+
+ this.$getTop = function(row, layerConfig) {
+ return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
+ };
+
+ /**
+ * Draws a marker, which spans a range of text in a single line
+ */
+ this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
+ // selection start
+ var row = range.start.row;
+
+ var lineRange = new Range(
+ row, range.start.column,
+ row, this.session.getScreenLastRowColumn(row)
+ );
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
+
+ // selection end
+ row = range.end.row;
+ lineRange = new Range(row, 0, row, range.end.column);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, "text");
+
+ for (row = range.start.row + 1; row < range.end.row; row++) {
+ lineRange.start.row = row;
+ lineRange.end.row = row;
+ lineRange.end.column = this.session.getScreenLastRowColumn(row);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
+ }
+ };
+
+ /**
+ * Draws a multi line marker, where lines span the full width
+ */
+ this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
+ var padding = type === "background" ? 0 : this.$padding;
+ var layerWidth = layerConfig.width + 2 * this.$padding - padding;
+ // from selection start to the end of the line
+ var height = layerConfig.lineHeight;
+ var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
+ var top = this.$getTop(range.start.row, layerConfig);
+ var left = Math.round(
+ padding + range.start.column * layerConfig.characterWidth
+ );
+
+ stringBuilder.push(
+ "<div class='", clazz, "' style='",
+ "height:", height, "px;",
+ "width:", width, "px;",
+ "top:", top, "px;",
+ "left:", left, "px;'></div>"
+ );
// from start of the last line to the selection end
top = this.$getTop(range.end.row, layerConfig);
@@ -6862,15 +7205,16 @@ var Cursor = function(parentEl) {
}, 1000);
};
- this.getPixelPosition = function(onScreen) {
+ this.getPixelPosition = function(position, onScreen) {
if (!this.config || !this.session) {
return {
left : 0,
top : 0
};
}
- var position = this.session.selection.getCursor();
+ if (!position)
+ position = this.session.selection.getCursor();
var pos = this.session.documentToScreenPosition(position);
var cursorLeft = Math.round(this.$padding +
pos.column * this.config.characterWidth);
@@ -6886,7 +7230,7 @@ var Cursor = function(parentEl) {
this.update = function(config) {
this.config = config;
- this.pixelPos = this.getPixelPosition(true);
+ this.pixelPos = this.getPixelPosition(null, true);
this.cursor.style.left = this.pixelPos.left + "px";
this.cursor.style.top = this.pixelPos.top + "px";
@@ -7444,316 +7788,6 @@ define("ace/css/editor.css",[], "\
}\
");
-define("ace/lib/event",[], function(require, exports, module) {
-
-var keys = require("ace/lib/keys");
-var useragent = require("ace/lib/useragent");
-var dom = require("ace/lib/dom");
-
-exports.addListener = function(elem, type, callback) {
- if (elem.addEventListener) {
- return elem.addEventListener(type, callback, false);
- }
- if (elem.attachEvent) {
- var wrapper = function() {
- callback(window.event);
- };
- callback._wrapper = wrapper;
- elem.attachEvent("on" + type, wrapper);
- }
-};
-
-exports.removeListener = function(elem, type, callback) {
- if (elem.removeEventListener) {
- return elem.removeEventListener(type, callback, false);
- }
- if (elem.detachEvent) {
- elem.detachEvent("on" + type, callback._wrapper || callback);
- }
-};
-
-/**
-* Prevents propagation and clobbers the default action of the passed event
-*/
-exports.stopEvent = function(e) {
- exports.stopPropagation(e);
- exports.preventDefault(e);
- return false;
-};
-
-exports.stopPropagation = function(e) {
- if (e.stopPropagation)
- e.stopPropagation();
- else
- e.cancelBubble = true;
-};
-
-exports.preventDefault = function(e) {
- if (e.preventDefault)
- e.preventDefault();
- else
- e.returnValue = false;
-};
-
-exports.getDocumentX = function(e) {
- if (e.clientX) {
- return e.clientX + dom.getPageScrollLeft();
- } else {
- return e.pageX;
- }
-};
-
-exports.getDocumentY = function(e) {
- if (e.clientY) {
- return e.clientY + dom.getPageScrollTop();
- } else {
- return e.pageY;
- }
-};
-
-/**
- * @return {Number} 0 for left button, 1 for middle button, 2 for right button
- */
-exports.getButton = function(e) {
- if (e.type == "dblclick")
- return 0;
- else if (e.type == "contextmenu")
- return 2;
-
- // DOM Event
- if (e.preventDefault) {
- return e.button;
- }
- // old IE
- else {
- return {1:0, 2:2, 4:1}[e.button];
- }
-};
-
-if (document.documentElement.setCapture) {
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
- function onMouseMove(e) {
- eventHandler(e);
- return exports.stopPropagation(e);
- }
-
- var called = false;
- function onReleaseCapture(e) {
- eventHandler(e);
-
- if (!called) {
- called = true;
- releaseCaptureHandler(e);
- }
-
- exports.removeListener(el, "mousemove", eventHandler);
- exports.removeListener(el, "mouseup", onReleaseCapture);
- exports.removeListener(el, "losecapture", onReleaseCapture);
-
- el.releaseCapture();
- }
-
- exports.addListener(el, "mousemove", eventHandler);
- exports.addListener(el, "mouseup", onReleaseCapture);
- exports.addListener(el, "losecapture", onReleaseCapture);
- el.setCapture();
- };
-}
-else {
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
- function onMouseMove(e) {
- eventHandler(e);
- e.stopPropagation();
- }
-
- function onMouseUp(e) {
- eventHandler && eventHandler(e);
- releaseCaptureHandler && releaseCaptureHandler(e);
-
- document.removeEventListener("mousemove", onMouseMove, true);
- document.removeEventListener("mouseup", onMouseUp, true);
-
- e.stopPropagation();
- }
-
- document.addEventListener("mousemove", onMouseMove, true);
- document.addEventListener("mouseup", onMouseUp, true);
- };
-}
-
-exports.addMouseWheelListener = function(el, callback) {
- var max = 0;
- var listener = function(e) {
- if (e.wheelDelta !== undefined) {
-
- // some versions of Safari (e.g. 5.0.5) report insanely high
- // scroll values. These browsers require a higher factor
- if (Math.abs(e.wheelDeltaY) > max)
- max = Math.abs(e.wheelDeltaY);
-
- if (max > 5000)
- var factor = 400;
- else
- var factor = 8;
-
- if (e.wheelDeltaX !== undefined) {
- e.wheelX = -e.wheelDeltaX / factor;
- e.wheelY = -e.wheelDeltaY / factor;
- } else {
- e.wheelX = 0;
- e.wheelY = -e.wheelDelta / factor;
- }
- }
- else {
- if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
- e.wheelX = (e.detail || 0) * 5;
- e.wheelY = 0;
- } else {
- e.wheelX = 0;
- e.wheelY = (e.detail || 0) * 5;
- }
- }
- callback(e);
- };
- exports.addListener(el, "DOMMouseScroll", listener);
- exports.addListener(el, "mousewheel", listener);
-};
-
-exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
- var clicks = 0;
- var startX, startY;
-
- var listener = function(e) {
- clicks += 1;
- if (clicks == 1) {
- startX = e.clientX;
- startY = e.clientY;
-
- setTimeout(function() {
- clicks = 0;
- }, timeout || 600);
- }
-
- var isButton = exports.getButton(e) == button;
- if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
- clicks = 0;
-
- if (clicks == count) {
- clicks = 0;
- callback(e);
- }
-
- if (isButton)
- return exports.preventDefault(e);
- };
-
- exports.addListener(el, "mousedown", listener);
- useragent.isOldIE && exports.addListener(el, "dblclick", listener);
-};
-
-function normalizeCommandKeys(callback, e, keyCode) {
- var hashId = 0;
- if (useragent.isOpera && useragent.isMac) {
- hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
- | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
- } else {
- hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
- | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
- }
-
- if (keyCode in keys.MODIFIER_KEYS) {
- switch (keys.MODIFIER_KEYS[keyCode]) {
- case "Alt":
- hashId = 2;
- break;
- case "Shift":
- hashId = 4;
- break;
- case "Ctrl":
- hashId = 1;
- break;
- default:
- hashId = 8;
- break;
- }
- keyCode = 0;
- }
-
- if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
- keyCode = 0;
- }
-
- // If there is no hashID and the keyCode is not a function key, then
- // we don't call the callback as we don't handle a command key here
- // (it's a normal key/character input).
- if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
- return false;
- }
- return callback(e, hashId, keyCode);
-}
-
-exports.addCommandKeyListener = function(el, callback) {
- var addListener = exports.addListener;
- if (useragent.isOldGecko) {
- // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
- // event if the user pressed the key for a longer time. Instead, the
- // keydown event was fired once and later on only the keypress event.
- // To emulate the 'right' keydown behavior, the keyCode of the initial
- // keyDown event is stored and in the following keypress events the
- // stores keyCode is used to emulate a keyDown event.
- var lastKeyDownKeyCode = null;
- addListener(el, "keydown", function(e) {
- lastKeyDownKeyCode = e.keyCode;
- });
- addListener(el, "keypress", function(e) {
- return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
- });
- } else {
- var lastDown = null;
-
- addListener(el, "keydown", function(e) {
- lastDown = e.keyIdentifier || e.keyCode;
- return normalizeCommandKeys(callback, e, e.keyCode);
- });
-
- // repeated keys are fired as keypress and not keydown events
- if (useragent.isMac && useragent.isOpera) {
- addListener(el, "keypress", function(e) {
- var keyId = e.keyIdentifier || e.keyCode;
- if (lastDown !== keyId) {
- return normalizeCommandKeys(callback, e, lastDown);
- } else {
- lastDown = null;
- }
- });
- }
- }
-};
-
-if (window.postMessage) {
- var postMessageId = 1;
- exports.nextTick = function(callback, win) {
- win = win || window;
- var messageName = "zero-timeout-message-" + postMessageId;
- exports.addListener(win, "message", function listener(e) {
- if (e.data == messageName) {
- exports.stopPropagation(e);
- exports.removeListener(win, "message", listener);
- callback();
- }
- });
- win.postMessage(messageName, "*");
- };
-}
-else {
- exports.nextTick = function(callback, win) {
- win = win || window;
- window.setTimeout(callback, 0);
- };
-}
-
-});
-
define("ace/mouse/default_handlers",[], function(require, exports, module) {
var event = require("ace/lib/event");
@@ -9958,7 +9992,7 @@ function Folding() {
this.foldAll = function(startRow, endRow) {
var foldWidgets = this.foldWidgets;
- endRow = endRow || foldWidgets.length;
+ endRow = endRow || this.getLength();
for (var row = startRow || 0; row < endRow; row++) {
if (foldWidgets[row] == null)
foldWidgets[row] = this.getFoldWidget(row);
View
1 chrome/content/ace++/res/ace/mode-css.js
@@ -1 +0,0 @@
-define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client"],function(a,b,c){var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./css_highlight_rules").CssHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=a("../worker/worker_client").WorkerClient,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;if(e.length&&e[e.length-1].type=="comment")return d;var f=b.match(/^.*\{\s*$/);return f&&(d+=c),d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=new i(["ace"],"worker-css.js","ace/mode/css_worker","Worker");b.attachToDocument(a.getDocument()),b.on("csslint",function(b){var c=[];b.data.forEach(function(a){c.push({row:a.line-1,column:a.col-1,text:a.message,type:a.type,lint:a})}),a.setAnnotations(c)})}}.call(j.prototype),b.Mode=j}),define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./text_highlight_rules").TextHighlightRules,g=function(){function g(a){var b=[],c=a.split("");for(var d=0;d<c.length;d++)b.push("[",c[d].toLowerCase(),c[d].toUpperCase(),"]");return b.join("")}var a=e.arrayToMap("-moz-box-sizing|-webkit-box-sizing|appearance|azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|-moz-border-radius|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index".split("|")),b=e.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")),c=e.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero".split("|")),d=e.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|")),f="\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))",h=[{token:"comment",merge:!0,regex:"\\/\\*",next:"ruleset_comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:f+g("em")},{token:"constant.numeric",regex:f+g("ex")},{token:"constant.numeric",regex:f+g("px")},{token:"constant.numeric",regex:f+g("cm")},{token:"constant.numeric",regex:f+g("mm")},{token:"constant.numeric",regex:f+g("in")},{token:"constant.numeric",regex:f+g("pt")},{token:"constant.numeric",regex:f+g("pc")},{token:"constant.numeric",regex:f+g("deg")},{token:"constant.numeric",regex:f+g("rad")},{token:"constant.numeric",regex:f+g("grad")},{token:"constant.numeric",regex:f+g("ms")},{token:"constant.numeric",regex:f+g("s")},{token:"constant.numeric",regex:f+g("hz")},{token:"constant.numeric",regex:f+g("khz")},{token:"constant.numeric",regex:f+"%"},{token:"constant.numeric",regex:f},{token:"constant.numeric",regex:"#[a-fA-F0-9]{6}"},{token:"constant.numeric",regex:"#[a-fA-F0-9]{3}"},{token:function(e){return a.hasOwnProperty(e.toLowerCase())?"support.type":b.hasOwnProperty(e.toLowerCase())?"support.function":c.hasOwnProperty(e.toLowerCase())?"support.constant":d.hasOwnProperty(e.toLowerCase())?"support.constant.color":"text"},regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}],i=e.copyArray(h);i.unshift({token:"paren.rparen",regex:"\\}",next:"start"});var j=e.copyArray(h);j.unshift({token:"paren.rparen",regex:"\\}",next:"media"});var k=[{token:"comment",merge:!0,regex:".+"}],l=e.copyArray(k);l.unshift({token:"comment",regex:".*?\\*\\/",next:"start"});var m=e.copyArray(k);m.unshift({token:"comment",regex:".*?\\*\\/",next:"media"});var n=e.copyArray(k);n.unshift({token:"comment",regex:".*?\\*\\/",next:"ruleset"}),this.$rules={start:[{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"\\{",next:"ruleset"},{token:"string",regex:"@media.*?{",next:"media"},{token:"keyword",regex:"#[a-zA-Z0-9-_]+"},{token:"variable",regex:"\\.[a-zA-Z0-9-_]+"},{token:"string",regex:":[a-zA-Z0-9-_]+"},{token:"constant",regex:"[a-zA-Z0-9-_]+"}],media:[{token:"comment",merge:!0,regex:"\\/\\*",next:"media_comment"},{token:"paren.lparen",regex:"\\{",next:"media_ruleset"},{token:"string",regex:"\\}",next:"start"},{token:"keyword",regex:"#[a-zA-Z0-9-_]+"},{token:"variable",regex:"\\.[a-zA-Z0-9-_]+"},{token:"string",regex:":[a-zA-Z0-9-_]+"},{token:"constant",regex:"[a-zA-Z0-9-_]+"}],comment:l,ruleset:i,ruleset_comment:n,media_ruleset:j,media_comment:m}};d.inherits(g,f),b.CssHighlightRules=g}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("../range").Range,e=function(){};((function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}})).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/event_emitter").EventEmitter,f=function(b,c,d,e){this.changeListener=this.changeListener.bind(this);if(window.require.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=this.$normalizePath(a.nameToUrl("ace/worker/worker",null,"_")),g=this.$worker=new Worker(h),i={};for(var j=0;j<b.length;j++){var k=b[j],l=this.$normalizePath(a.nameToUrl(k,null,"_").replace(/.js$/,""));i[k]=l}}this.$worker.postMessage({init:!0,tlns:i,module:d,classname:e}),this.callbackId=1,this.callbacks={};var m=this;this.$worker.onerror=function(a){throw window.console&&console.log&&console.log(a),a},this.$worker.onmessage=function(a){var b=a.data;switch(b.type){case"log":window.console&&console.log&&console.log(b.data);break;case"event":m._dispatchEvent(b.name,{data:b.data});break;case"call":var c=m.callbacks[b.id];c&&(c(b.data),delete m.callbacks[b.id])}}};((function(){d.implement(this,e),this.$normalizePath=function(a){return a.match(/^\w+:/)||(a=location.protocol+"//"+location.host+(a.charAt(0)=="/"?"":location.pathname.replace(/\/[^\/]*$/,""))+"/"+a.replace(/^[\/]+/,"")),a},this.$guessBasePath=function(){if(a.aceBaseUrl)return a.aceBaseUrl;var b=document.getElementsByTagName("script");for(var c=0;c<b.length;c++){var d=b[c],e=d.getAttribute("data-ace-base");if(e)return e.replace(/\/*$/,"/");var f=d.src||d.getAttribute("src");if(!f)continue;var g=f.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);if(g)return g[1]||g[2]}return""},this.terminate=function(){this._dispatchEvent("terminate",{}),this.$worker.terminate(),this.$worker=null,this.$doc.removeEventListener("change",this.changeListener),this.$doc=null},this.send=function(a,b){this.$worker.postMessage({command:a,args:b})},this.call=function(a,b,c){if(c){var d=this.callbackId++;this.callbacks[d]=c,b.push(d)}this.send(a,b)},this.emit=function(a,b){try{this.$worker.postMessage({event:a,data:{data:b.data}})}catch(c){}},this.attachToDocument=function(a){this.$doc&&this.terminate(),this.$doc=a,this.call("setValue",[a.getValue()]),a.on("change",this.changeListener)},this.changeListener=function(a){a.range={start:a.data.range.start,end:a.data.range.end},this.emit("change",a)}})).call(f.prototype),b.WorkerClient=f})
View
32 chrome/content/ace++/res/ace/mode-html.js
@@ -1,5 +1,5 @@
define("ace/mode/html",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
@@ -45,7 +45,7 @@ exports.Mode = Mode;
});
define("ace/mode/javascript",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
@@ -140,7 +140,7 @@ exports.Mode = Mode;
});
define("ace/mode/css",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
@@ -191,7 +191,7 @@ exports.Mode = Mode;
});
define("ace/mode/html_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
@@ -288,7 +288,7 @@ exports.HtmlHighlightRules = HtmlHighlightRules;
});
define("ace/mode/behaviour/xml",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var Behaviour = require("ace/mode/behaviour").Behaviour;
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
@@ -342,7 +342,7 @@ exports.XmlBehaviour = XmlBehaviour;
});
define("ace/mode/folding/html",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var MixedFoldMode = require("ace/mode/folding/mixed").FoldMode;
var XmlFoldMode = require("ace/mode/folding/xml").FoldMode;
@@ -391,7 +391,7 @@ oop.inherits(FoldMode, MixedFoldMode);
});
define("ace/mode/javascript_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var unicode = require("ace/unicode");
@@ -679,7 +679,7 @@ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
});
define("ace/mode/matching_brace_outdent",[], function(require, exports, module) {
-
+
var Range = require("ace/range").Range;
var MatchingBraceOutdent = function() {};
@@ -723,7 +723,7 @@ exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
define("ace/mode/behaviour/cstyle",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var Behaviour = require("ace/mode/behaviour").Behaviour;
@@ -908,7 +908,7 @@ exports.CstyleBehaviour = CstyleBehaviour;
});
define("ace/mode/folding/cstyle",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var Range = require("ace/range").Range;
var BaseFoldMode = require("ace/mode/folding/fold_mode").FoldMode;
@@ -966,7 +966,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
define("ace/mode/css_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
@@ -1195,7 +1195,7 @@ exports.CssHighlightRules = CssHighlightRules;
});
define("ace/mode/xml_util",[], function(require, exports, module) {
-
+
var lang = require("ace/lib/lang");
var formTags = lang.arrayToMap(
@@ -1304,7 +1304,7 @@ exports.tag = function(states, name, nextState) {
});
define("ace/mode/folding/mixed",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var BaseFoldMode = require("ace/mode/folding/fold_mode").FoldMode;
@@ -1355,7 +1355,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
define("ace/mode/folding/xml",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var Range = require("ace/range").Range;
@@ -1583,7 +1583,7 @@ oop.inherits(FoldMode, BaseFoldMode);
});
define("ace/mode/doc_comment_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
@@ -1642,7 +1642,7 @@ exports.DocCommentHighlightRules = DocCommentHighlightRules;
});
define("ace/mode/folding/fold_mode",[], function(require, exports, module) {
-
+
var Range = require("ace/range").Range;
var FoldMode = exports.FoldMode = function() {};
View
1 chrome/content/ace++/res/ace/mode-javascript.js
@@ -1 +0,0 @@
-define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle"],function(a,b,c){var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./javascript_highlight_rules").JavaScriptHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=a("../range").Range,j=a("../worker/worker_client").WorkerClient,k=a("./behaviour/cstyle").CstyleBehaviour,l=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h,this.$behaviour=new k};d.inherits(l,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"||a=="regex_allowed"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start"||a=="regex_allowed")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=new j(["ace"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");return b.attachToDocument(a.getDocument()),b.on("jslint",function(b){var c=[];for(var d=0;d<b.data.length;d++){var e=b.data[d];e&&c.push({row:e.line-1,column:e.character-1,text:e.reason,type:"warning",lint:e})}a.setAnnotations(c)}),b.on("narcissus",function(b){a.setAnnotations([b.data])}),b.on("terminate",function(){a.clearAnnotations()}),b}}.call(l.prototype),b.Mode=l}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/unicode","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/lang"),f=a("../unicode"),g=a("./doc_comment_highlight_rules").DocCommentHighlightRules,h=a("./text_highlight_rules").TextHighlightRules,i=function(){var a=e.arrayToMap("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document".split("|")),b=e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|const|yield|import|get|set".split("|")),c="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield",d=e.arrayToMap("__parent__|__count__|escape|unescape|with|__proto__".split("|")),h=e.arrayToMap("const|let|var|function".split("|")),i=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),j=e.arrayToMap("class|enum|extends|super|export|implements|private|public|interface|package|protected|static".split("|")),k="["+f.packages.L+"\\$_]["+f.packages.L+f.packages.Mn+f.packages.Mc+f.packages.Nd+f.packages.Pc+"\\$_]*\\b";this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},(new g).getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:["keyword.definition","text","entity.name.function"],regex:"(function)(\\s+)("+k+")"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"keyword",regex:"(?:"+c+")\\b",next:"regex_allowed"},{token:function(c){return a.hasOwnProperty(c)?"variable.language":d.hasOwnProperty(c)?"invalid.deprecated":h.hasOwnProperty(c)?"keyword.definition":b.hasOwnProperty(c)?"keyword":i.hasOwnProperty(c)?"constant.language":j.hasOwnProperty(c)?"invalid.illegal":c=="debugger"?"invalid.deprecated":"identifier"},regex:k},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",next:"regex_allowed"},{token:"punctuation.operator",regex:"\\?|\\:|\\,|\\;|\\.",next:"regex_allowed"},{token:"paren.lparen",regex:"[[({]",next:"regex_allowed"},{token:"paren.rparen",regex:"[\\])}]"},{token:"keyword.operator",regex:"\\/=?",next:"regex_allowed"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],regex_allowed:[{token:"comment",merge:!0,regex:"\\/\\*",next:"comment_regex_allowed"},{token:"comment",regex:"\\/\\/.*$"},{token:"string.regexp",regex:"\\/(?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*",next:"start"},{token:"text",regex:"\\s+"},{token:"empty",regex:"",next:"start"}],comment_regex_allowed:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"regex_allowed"},{token:"comment",merge:!0,regex:".+"}],comment:[{token:"comment",regex:".*?\\*\\/",merge:!0,next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}]},this.embedRules(g,"doc-",[(new g).getEndRule("start")])};d.inherits(i,h),b.JavaScriptHighlightRules=i}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("./text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},this.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("../range").Range,e=function(){};((function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}})).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/event_emitter").EventEmitter,f=function(b,c,d,e){this.changeListener=this.changeListener.bind(this);if(window.require.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=this.$normalizePath(a.nameToUrl("ace/worker/worker",null,"_")),g=this.$worker=new Worker(h),i={};for(var j=0;j<b.length;j++){var k=b[j],l=this.$normalizePath(a.nameToUrl(k,null,"_").replace(/.js$/,""));i[k]=l}}this.$worker.postMessage({init:!0,tlns:i,module:d,classname:e}),this.callbackId=1,this.callbacks={};var m=this;this.$worker.onerror=function(a){throw window.console&&console.log&&console.log(a),a},this.$worker.onmessage=function(a){var b=a.data;switch(b.type){case"log":window.console&&console.log&&console.log(b.data);break;case"event":m._dispatchEvent(b.name,{data:b.data});break;case"call":var c=m.callbacks[b.id];c&&(c(b.data),delete m.callbacks[b.id])}}};((function(){d.implement(this,e),this.$normalizePath=function(a){return a.match(/^\w+:/)||(a=location.protocol+"//"+location.host+(a.charAt(0)=="/"?"":location.pathname.replace(/\/[^\/]*$/,""))+"/"+a.replace(/^[\/]+/,"")),a},this.$guessBasePath=function(){if(a.aceBaseUrl)return a.aceBaseUrl;var b=document.getElementsByTagName("script");for(var c=0;c<b.length;c++){var d=b[c],e=d.getAttribute("data-ace-base");if(e)return e.replace(/\/*$/,"/");var f=d.src||d.getAttribute("src");if(!f)continue;var g=f.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);if(g)return g[1]||g[2]}return""},this.terminate=function(){this._dispatchEvent("terminate",{}),this.$worker.terminate(),this.$worker=null,this.$doc.removeEventListener("change",this.changeListener),this.$doc=null},this.send=function(a,b){this.$worker.postMessage({command:a,args:b})},this.call=function(a,b,c){if(c){var d=this.callbackId++;this.callbacks[d]=c,b.push(d)}this.send(a,b)},this.emit=function(a,b){try{this.$worker.postMessage({event:a,data:{data:b.data}})}catch(c){}},this.attachToDocument=function(a){this.$doc&&this.terminate(),this.$doc=a,this.call("setValue",[a.getValue()]),a.on("change",this.changeListener)},this.changeListener=function(a){a.range={start:a.data.range.start,end:a.data.range.end},this.emit("change",a)}})).call(f.prototype),b.WorkerClient=f}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour"],function(a,b,c){var d=a("../../lib/oop"),e=a("../behaviour").Behaviour,f=function(){this.add("braces","insertion",function(a,b,c,d,e){if(e=="{"){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"{"+g+"}",selection:!1}:{text:"{}",selection:[1,1]}}if(e=="}"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var k=d.$findOpeningBracket("}",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}else if(e=="\n"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var l=d.findMatchingBracket({row:h.row,column:h.column+1});if(!l)return null;var m=this.getNextLineIndent(a,i.substring(0,i.length-1),d.getTabString()),n=this.$getIndent(d.doc.getLine(l.row));return{text:"\n"+m+"\n"+n,selection:[1,m.length,1,m.length]}}}}),this.add("braces","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="{"){var g=d.doc.getLine(e.start.row),h=g.substring(e.end.column,e.end.column+1);if(h=="}")return e.end.column++,e}}),this.add("parens","insertion",function(a,b,c,d,e){if(e=="("){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"("+g+")",selection:!1}:{text:"()",selection:[1,1]}}if(e==")"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j==")"){var k=d.$findOpeningBracket(")",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="("){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h==")")return e.end.column++,e}}),this.add("string_dquotes","insertion",function(a,b,c,d,e){if(e=='"'){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);if(g!=="")return{text:'"'+g+'"',selection:!1};var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column-1,h.column);if(j=="\\")return null;var k=d.getTokens(f.start.row,f.start.row)[0].tokens,l=0,m,n=-1;for(var o=0;o<k.length;o++){m=k[o],m.type=="string"?n=-1:n<0&&(n=m.value.indexOf('"'));if(m.value.length+l>f.start.column)break;l+=k[o].value.length}if(!m||n<0&&m.type!=="comment"&&(m.type!=="string"||f.start.column!==m.value.length+l-1&&m.value.lastIndexOf('"')===m.value.length-1))return{text:'""',selection:[1,1]};if(m&&m.type==="string"){var p=i.substring(h.column,h.column+1);if(p=='"')return{text:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=='"'){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h=='"')return e.end.column++,e}})};d.inherits(f,e),b.CstyleBehaviour=f})
View
4 chrome/content/ace++/res/ace/mode-json.js
@@ -1,5 +1,5 @@
define("ace/mode/json",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
@@ -45,7 +45,7 @@ exports.Mode = Mode;
});
define("ace/mode/json_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
View
4 chrome/content/ace++/res/ace/mode-xml.js
@@ -1,5 +1,5 @@
define("ace/mode/xml",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
@@ -27,7 +27,7 @@ exports.Mode = Mode;
});
define("ace/mode/xml_highlight_rules",[], function(require, exports, module) {
-
+
var oop = require("ace/lib/oop");
var xmlUtil = require("ace/mode/xml_util");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
View
2 chrome/content/ace++/res/ace/theme-eclipse.js
@@ -1,5 +1,5 @@
define("ace/theme/eclipse",[], function(require, exports, module) {
-
+
exports.isDark = false;
exports.cssText = ".ace-eclipse .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
View
1 chrome/content/ace++/res/ace/theme-textmate.js
@@ -1 +0,0 @@
-define("ace/theme/textmate",["require","exports","module"],function(a,b,c){b.cssClass="ace-tm",b.cssText=".ace-tm .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-tm .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-tm .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-tm .ace_gutter-layer { width: 100%; text-align: right;}.ace-tm .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-tm .ace_print_margin { width: 1px; background: #e8e8e8;}.ace-tm .ace_text-layer { cursor: text;}.ace-tm .ace_cursor { border-left: 2px solid black;}.ace-tm .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid black;} .ace-tm .ace_line .ace_invisible { color: rgb(191, 191, 191);}.ace-tm .ace_line .ace_keyword { color: blue;}.ace-tm .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-tm .ace_line .ace_constant.ace_language { color: rgb(88, 92, 246);}.ace-tm .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_invalid { background-color: rgb(153, 0, 0); color: white;}.ace-tm .ace_line .ace_fold { background-color: #E4E4E4; border-radius: 3px;}.ace-tm .ace_line .ace_support.ace_function { color: rgb(60, 76, 114);}.ace-tm .ace_line .ace_support.ace_constant { color: rgb(6, 150, 14);}.ace-tm .ace_line .ace_support.ace_type,.ace-tm .ace_line .ace_support.ace_class { color: rgb(109, 121, 222);}.ace-tm .ace_line .ace_keyword.ace_operator { color: rgb(104, 118, 135);}.ace-tm .ace_line .ace_string { color: rgb(3, 106, 7);}.ace-tm .ace_line .ace_comment { color: rgb(76, 136, 107);}.ace-tm .ace_line .ace_comment.ace_doc { color: rgb(0, 102, 255);}.ace-tm .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(128, 159, 191);}.ace-tm .ace_line .ace_constant.ace_numeric { color: rgb(0, 0, 205);}.ace-tm .ace_line .ace_variable { color: rgb(49, 132, 149);}.ace-tm .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function { color: #0000A2;}.ace-tm .ace_markup.ace_markupine { text-decoration:underline;}.ace-tm .ace_markup.ace_heading { color: rgb(12, 7, 255);}.ace-tm .ace_markup.ace_list { color:rgb(185, 6, 144);}.ace-tm .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack { background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_marker-layer .ace_selected_word { background: rgb(250, 250, 255); border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_meta.ace_tag { color:rgb(28, 2, 255);}.ace-tm .ace_string.ace_regex { color: rgb(255, 0, 0)}"})
View
468 chrome/content/ace++/res/beautify-html.js
@@ -1,468 +0,0 @@
-/*
-
- Style HTML
----------------
-
- Written by Nochum Sossonko, (nsossonko@hotmail.com)
-
- Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv>
- http://jsbeautifier.org/
-
-
- You are free to use this in any way you want, in case you find this useful or working for you.
-
- Usage:
- style_html(html_source);
-
- style_html(html_source, options);
-
- The options are:
- indent_size (default 4) — indentation size,
- indent_char (default space) — character to indent with,
- max_char (default 70) - maximum amount of characters per line,
- brace_style (default "collapse") - "collapse" | "expand" | "end-expand"
- put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.
- unformatted (default ['a']) - list of tags, that shouldn't be reformatted
-
- e.g.
-
- style_html(html_source, {
- 'indent_size': 2,
- 'indent_char': ' ',
- 'max_char': 78,
- 'brace_style': 'expand',
- 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u']
- });
-*/
-
-function style_html(html_source, options) {
-//Wrapper function to invoke all the necessary constructors and deal with the output.
-
- var multi_parser,
- indent_size,
- indent_character,
- max_char,
- brace_style;
-
- options = options || {};
- indent_size = options.indent_size || 4;
- indent_character = options.indent_char || ' ';
- brace_style = options.brace_style || 'collapse';
- max_char = options.max_char || '70';
- unformatted = options.unformatted || ['a'];
-
- function Parser() {
-
- this.pos = 0; //Parser position
- this.token = '';
- this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
- this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values
- parent: 'parent1',
- parentcount: 1,
- parent1: ''
- };
- this.tag_type = '';
- this.token_text = this.last_token = this.last_text = this.token_type = '';
-
- this.Utils = { //Uilities made available to the various functions
- whitespace: "\n\r\t ".split(''),
- single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed'.split(','), //all the single tags for HTML
- extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them
- in_array: function (what, arr) {
- for (var i=0; i<arr.length; i++) {
- if (what === arr[i]) {
- return true;
- }
- }
- return false;
- }
- }
-
- this.get_content = function () { //function to capture regular content between tags
-
- var input_char = '';
- var content = [];
- var space = false; //if a space is needed
- while (this.input.charAt(this.pos) !== '<') {
- if (this.pos >= this.input.length) {
- return content.length?content.join(''):['', 'TK_EOF'];
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
- this.line_char_count++;
-
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
- if (content.length) {
- space = true;
- }
- this.line_char_count--;
- continue; //don't want to insert unnecessary space
- }
- else if (space) {
- if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached
- content.push('\n');
- for (var i=0; i<this.indent_level; i++) {
- content.push(this.indent_string);
- }
- this.line_char_count = 0;
- }
- else{
- content.push(' ');
- this.line_char_count++;
- }
- space = false;
- }
- content.push(input_char); //letter at-a-time (or string) inserted to an array
- }
- return content.length?content.join(''):'';
- }
-
- this.get_script = function () { //get the full content of a script to pass to js_beautify
-
- var input_char = '';
- var content = [];
- var reg_match = new RegExp('\<\/script' + '\>', 'igm');
- reg_match.lastIndex = this.pos;
- var reg_array = reg_match.exec(this.input);
- var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script
- while(this.pos < end_script) { //get everything in between the script tags
- if (this.pos >= this.input.length) {
- return content.length?content.join(''):['', 'TK_EOF'];
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
-
- content.push(input_char);
- }
- return content.length?content.join(''):''; //we might not have any content at all
- }
-
- this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object
- if (this.tags[tag + 'count']) { //check for the existence of this tag type
- this.tags[tag + 'count']++;
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
- }
- else { //otherwise initialize this tag type
- this.tags[tag + 'count'] = 1;
- this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level
- }
- this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)
- this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
- }
-
- this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer
- if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it
- var temp_parent = this.tags.parent; //check to see if it's a closable tag.
- while (temp_parent) { //till we reach '' (the initial value);
- if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it
- break;
- }
- temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree
- }
- if (temp_parent) { //if we caught something
- this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly
- this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent
- }
- delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...
- delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself
- if (this.tags[tag + 'count'] == 1) {
- delete this.tags[tag + 'count'];
- }
- else {
- this.tags[tag + 'count']--;
- }
- }
- }
-
- this.get_tag = function () { //function to get a full tag and parse its type
- var input_char = '';
- var content = [];
- var space = false;
-
- do {
- if (this.pos >= this.input.length) {
- return content.length?content.join(''):['', 'TK_EOF'];
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++;
- this.line_char_count++;
-
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space
- space = true;
- this.line_char_count--;
- continue;
- }
-
- if (input_char === "'" || input_char === '"') {
- if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially
- input_char += this.get_unformatted(input_char);
- space = true;
- }
- }
-
- if (input_char === '=') { //no space before =
- space = false;
- }
-
- if (content.length && content[content.length-1] !== '=' && input_char !== '>'
- && space) { //no space after = or before >
- if (this.line_char_count >= this.max_char) {
- this.print_newline(false, content);
- this.line_char_count = 0;
- }
- else {
- content.push(' ');
- this.line_char_count++;
- }
- space = false;
- }
- content.push(input_char); //inserts character at-a-time (or string)
- } while (input_char !== '>');
-
- var tag_complete = content.join('');
- var tag_index;
- if (tag_complete.indexOf(' ') != -1) { //if there's whitespace, thats where the tag name ends
- tag_index = tag_complete.indexOf(' ');
- }
- else { //otherwise go with the tag ending
- tag_index = tag_complete.indexOf('>');
- }
- var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
- if (tag_complete.charAt(tag_complete.length-2) === '/' ||
- this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)
- this.tag_type = 'SINGLE';
- }
- else if (tag_check === 'script') { //for later script handling
- this.record_tag(tag_check);
- this.tag_type = 'SCRIPT';
- }
- else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)
- this.record_tag(tag_check);
- this.tag_type = 'STYLE';
- }
- else if (this.Utils.in_array(tag_check, unformatted)) { // do not reformat the "unformatted" tags
- var comment = this.get_unformatted('</'+tag_check+'>', tag_complete); //...delegate to get_unformatted function
- content.push(comment);
- this.tag_type = 'SINGLE';
- }
- else if (tag_check.charAt(0) === '!') { //peek for <!-- comment
- if (tag_check.indexOf('[if') != -1) { //peek for <!--[if conditional comment
- if (tag_complete.indexOf('!IE') != -1) { //this type needs a closing --> so...
- var comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted
- content.push(comment);
- }
- this.tag_type = 'START';
- }
- else if (tag_check.indexOf('[endif') != -1) {//peek for <!--[endif end conditional comment
- this.tag_type = 'END';
- this.unindent();
- }
- else if (tag_check.indexOf('[cdata[') != -1) { //if it's a <[cdata[ comment...
- var comment = this.get_unformatted(']]>', tag_complete); //...delegate to get_unformatted function
- content.push(comment);
- this.tag_type = 'SINGLE'; //<![CDATA[ comments are treated like single tags
- }
- else {
- var comment = this.get_unformatted('-->', tag_complete);
- content.push(comment);
- this.tag_type = 'SINGLE';
- }
- }
- else {
- if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending
- this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors
- this.tag_type = 'END';
- }
- else { //otherwise it's a start-tag
- this.record_tag(tag_check); //push it on the tag stack
- this.tag_type = 'START';
- }
- if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line
- this.print_newline(true, this.output);
- }
- }
- return content.join(''); //returns fully formatted tag
- }
-
- this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety
-
- if (orig_tag && orig_tag.indexOf(delimiter) != -1) {
- return '';
- }
- var input_char = '';
- var content = '';
- var space = true;
- do {
-
- if (this.pos >= this.input.length) {
- return content;
- }
-
- input_char = this.input.charAt(this.pos);
- this.pos++
-
- if (this.Utils.in_array(input_char, this.Utils.whitespace)) {
- if (!space) {
- this.line_char_count--;
- continue;
- }
- if (input_char === '\n' || input_char === '\r') {
- content += '\n';
- /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'
- for (var i=0; i<this.indent_level; i++) {
- content += this.indent_string;
- }
- space = false; //...and make sure other indentation is erased
- */
- this.line_char_count = 0;
- continue;
- }
- }
- content += input_char;
- this.line_char_count++;
- space = true;
-
-
- } while (content.indexOf(delimiter) == -1);
- return content;
- }
-
- this.get_token = function () { //initial handler for token-retrieval
- var token;
-
- if (this.last_token === 'TK_TAG_SCRIPT') { //check if we need to format javascript
- var temp_token = this.get_script();
- if (typeof temp_token !== 'string') {
- return temp_token;
- }
- token = js_beautify(temp_token.replace(/^[\r\n]+/, ''), {
- 'indent_size': this.indent_size,
- 'indent_char': this.indent_character,
- 'brace_style': this.brace_style
- }); //call the JS Beautifier
- return [token, 'TK_CONTENT'];
- }
- if (this.current_mode === 'CONTENT') {
- token = this.get_content();
- if (typeof token !== 'string') {
- return token;
- }
- else {
- return [token, 'TK_CONTENT'];
- }
- }
-
- if (this.current_mode === 'TAG') {
- token = this.get_tag();
- if (typeof token !== 'string') {
- return token;
- }
- else {
- var tag_name_type = 'TK_TAG_' + this.tag_type;
- return [token, tag_name_type];
- }
- }
- }
-
- this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
-
- this.input = js_source || ''; //gets the input for the Parser
- this.output = [];
- this.indent_character = indent_character;
- this.indent_string = '';
- this.indent_size = indent_size;
- this.brace_style = brace_style;
- this.indent_level = 0;
- this.max_char = max_char;
- this.line_char_count = 0; //count to see if max_char was exceeded
-
- for (var i=0; i<this.indent_size; i++) {
- this.indent_string += this.indent_character;
- }
-
- this.print_newline = function (ignore, arr) {
- this.line_char_count = 0;
- if (!arr || !arr.length) {
- return;
- }
- if (!ignore) { //we might want the extra line
- while (this.Utils.in_array(arr[arr.length-1], this.Utils.whitespace)) {
- arr.pop();
- }
- }
- arr.push('\n');
- for (var i=0; i<this.indent_level; i++) {
- arr.push(this.indent_string);
- }
- }
-
- this.print_token = function (text) {
- this.output.push(text);
- }
-
- this.indent = function () {
- this.indent_level++;
- }
-
- this.unindent = function () {
- if (this.indent_level > 0) {
- this.indent_level--;
- }
- }
- }
- return this;
- }
-
- /*_____________________--------------------_____________________*/
-
- multi_parser = new Parser(); //wrapping functions Parser
- multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
-
- while (true) {
- var t = multi_parser.get_token();
- multi_parser.token_text = t[0];
- multi_parser.token_type = t[1];
-
- if (multi_parser.token_type === 'TK_EOF') {
- break;
- }
-
- switch (multi_parser.token_type) {
- case 'TK_TAG_START':
- case 'TK_TAG_STYLE':
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.indent();
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_SCRIPT':
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_END':
- multi_parser.print_newline(true, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_TAG_SINGLE':
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- multi_parser.current_mode = 'CONTENT';
- break;
- case 'TK_CONTENT':
- if (multi_parser.token_text !== '') {
- multi_parser.print_newline(false, multi_parser.output);
- multi_parser.print_token(multi_parser.token_text);
- }
- multi_parser.current_mode = 'TAG';
- break;
- }
- multi_parser.last_token = multi_parser.token_type;
- multi_parser.last_text = multi_parser.token_text;
- }
- return multi_parser.output.join('');
-}
View
4 chrome/content/ace++/res/beautify.js
@@ -1300,8 +1300,8 @@ function css_beautify(source_text, options) {
output.pop();
if (output.length)
- output.push('\n', indentString);
- else
+ output.push('\n');
+ if (indentString)
output.push(indentString);
}
print.singleSpace = function() {
View
4 chrome/content/ace++/startup.js
@@ -275,10 +275,6 @@ exports.launch = function(env, options) {
// not needed in acebug
Renderer.prototype.moveTextAreaToCursor =
require("ace/layer/text").Text.prototype.$pollSizeChanges = function(){}
- Editor.prototype.setFontSize = function(size){