diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..354d9ca3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +.settings.xml +.settings.xml.old \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..0498a164 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "tool/support/node-o3-xml"] + path = tool/support/node-o3-xml + url = git://github.com/ajaxorg/node-o3-xml.git +[submodule "tool/support/async"] + path = tool/support/async + url = git://github.com/fjakobs/async.js.git +[submodule "support/requirejs"] + path = support/requirejs + url = git://github.com/jrburke/requirejs.git +[submodule "support/node-o3-xml"] + path = support/node-o3-xml + url = git://github.com/ajaxorg/node-o3-xml.git diff --git a/.project b/.project new file mode 100644 index 00000000..dbb46bdc --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + editor + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..02bbb60b --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..82e66a2c --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +package: + rm -rf build + support/requirejs/build/build.sh build.js diff --git a/build.js b/build.js new file mode 100644 index 00000000..03e04890 --- /dev/null +++ b/build.js @@ -0,0 +1,79 @@ +{ + baseUrl: "./lib", + dir: "build", + + //- "closure": uses Google's Closure Compiler in simple optimization + //mode to minify the code. + //- "closure.keepLines": Same as closure option, but keeps line returns + //in the minified files. + //- "none": no minification will be done. + optimize: "closure.keepLines", + inlineText: true, + useStrict: false, + + pragmas: { + jquery: false, + requireExcludeModify: true, + requireExcludePlugin: false, + requireExcludePageLoad: false + }, + + skipPragmas: false, + execModules: false, + skipModuleInsertion: false, + + modules: [ + { + name: "ace/Editor", + include: [ + "ace/Document", + "ace/UndoManager", + "ace/VirtualRenderer", + + "ace/mode/JavaScript", + "ace/theme/TextMate" + ], + includeRequire: false + }, + + { + name: "ace/theme/Eclipse", + exclude: [ + "ace/lib/lang", + "ace/lib/dom", + "ace/lib/oop" + ] + }, + { + name: "ace/mode/Xml", + exclude: [ + "ace/lib/oop", + "ace/Tokenizer", + "ace/mode/Text" + ] + }, + { + name: "ace/mode/Css", + exclude: [ + "ace/lib/oop", + "ace/lib/lang", + "ace/Tokenizer", + "ace/Range", + "ace/mode/Text" + ] + }, + { + name: "ace/mode/Html", + exclude: [ + "ace/lib/oop", + "ace/lib/lang", + "ace/Tokenizer", + "ace/Range", + "ace/mode/Text", + "ace/mode/JavaScript", + "ace/mode/Css", + ] + } + ] +} + diff --git a/build/ace/BackgroundTokenizer.js b/build/ace/BackgroundTokenizer.js new file mode 100644 index 00000000..57711cbe --- /dev/null +++ b/build/ace/BackgroundTokenizer.js @@ -0,0 +1,81 @@ +/* + LGPLv3 +*/ +require.def("ace/BackgroundTokenizer", ["ace/lib/oop", "ace/MEventEmitter"], function(i, j) { + var h = function(a, c) { + this.running = false; + this.textLines = []; + this.lines = []; + this.currentLine = 0; + this.tokenizer = a; + var b = this; + this.$worker = function() { + if(b.running) { + for(var e = new Date, f = b.currentLine, d = b.textLines, g = 0, k = c.getLastVisibleRow();b.currentLine < d.length;) { + b.lines[b.currentLine] = b.$tokenizeRows(b.currentLine, b.currentLine)[0]; + b.currentLine++; + g += 1; + if(g % 5 == 0 && new Date - e > 20) { + b.fireUpdateEvent(f, b.currentLine - 1); + b.running = setTimeout(b.$worker, b.currentLine < k ? 20 : 100); + return + } + }b.running = false; + b.fireUpdateEvent(f, d.length - 1) + } + } + }; + (function() { + i.implement(this, j); + this.setTokenizer = function(a) { + this.tokenizer = a; + this.lines = []; + this.start(0) + }; + this.setLines = function(a) { + this.textLines = a; + this.lines = []; + this.stop() + }; + this.fireUpdateEvent = function(a, c) { + this.$dispatchEvent("update", {data:{first:a, last:c}}) + }; + this.start = function(a) { + this.currentLine = Math.min(a || 0, this.currentLine, this.textLines.length); + this.lines.splice(this.currentLine, this.lines.length); + this.stop(); + this.running = setTimeout(this.$worker, 700) + }; + this.stop = function() { + this.running && clearTimeout(this.running); + this.running = false + }; + this.getTokens = function(a, c, b) { + b(this.$tokenizeRows(a, c)) + }; + this.getState = function(a, c) { + c(this.$tokenizeRows(a, a)[0].state) + }; + this.$tokenizeRows = function(a, c) { + var b = [], e = "start", f = false; + if(a > 0 && this.lines[a - 1]) { + e = this.lines[a - 1].state; + f = true + }for(a = a;a <= c;a++) { + if(this.lines[a]) { + d = this.lines[a]; + e = d.state; + b.push(d) + }else { + var d = this.tokenizer.getLineTokens(this.textLines[a] || "", e); + e = d.state; + b.push(d); + if(f) { + this.lines[a] = d + } + } + }return b + } + }).call(h.prototype); + return h +}); \ No newline at end of file diff --git a/build/ace/Document.js b/build/ace/Document.js new file mode 100644 index 00000000..b4400664 --- /dev/null +++ b/build/ace/Document.js @@ -0,0 +1,461 @@ +/* + LGPLv3 +*/ +require.def("ace/Document", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Selection", "ace/mode/Text", "ace/Range"], function(l, i, m, n, o, g) { + var j = function(a, b) { + this.modified = true; + this.lines = []; + this.selection = new n(this); + this.$breakpoints = []; + this.listeners = []; + b && this.setMode(b); + i.isArray(a) ? this.$insertLines(0, a) : this.$insert({row:0, column:0}, a) + }; + (function() { + l.implement(this, m); + this.$undoManager = null; + this.$split = function(a) { + return a.split(/\r\n|\r|\n/) + }; + this.setValue = function(a) { + var b = [0, this.lines.length]; + b.push.apply(b, this.$split(a)); + this.lines.splice.apply(this.lines, b); + this.modified = true; + this.fireChangeEvent(0) + }; + this.toString = function() { + return this.lines.join(this.$getNewLineCharacter()) + }; + this.getSelection = function() { + return this.selection + }; + this.fireChangeEvent = function(a, b) { + this.$dispatchEvent("change", {data:{firstRow:a, lastRow:b}}) + }; + this.setUndoManager = function(a) { + this.$undoManager = a; + this.$deltas = []; + this.$informUndoManager && this.$informUndoManager.cancel(); + if(a) { + var b = this; + this.$informUndoManager = i.deferredCall(function() { + b.$deltas.length > 0 && a.execute({action:"aceupdate", args:[b.$deltas, b]}); + b.$deltas = [] + }) + } + }; + this.$defaultUndoManager = {undo:function() { + }, redo:function() { + }}; + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager + }; + this.getTabString = function() { + return this.getUseSoftTabs() ? i.stringRepeat(" ", this.getTabSize()) : "\t" + }; + this.$useSoftTabs = true; + this.setUseSoftTabs = function(a) { + if(this.$useSoftTabs !== a) { + this.$useSoftTabs = a + } + }; + this.getUseSoftTabs = function() { + return this.$useSoftTabs + }; + this.$tabSize = 4; + this.setTabSize = function(a) { + if(!(isNaN(a) || this.$tabSize === a)) { + this.modified = true; + this.$tabSize = a; + this.$dispatchEvent("changeTabSize") + } + }; + this.getTabSize = function() { + return this.$tabSize + }; + this.getBreakpoints = function() { + return this.$breakpoints + }; + this.setBreakpoints = function(a) { + this.$breakpoints = []; + for(var b = 0;b < a.length;b++) { + this.$breakpoints[a[b]] = true + }this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoints = function() { + this.$breakpoints = []; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.setBreakpoint = function(a) { + this.$breakpoints[a] = true; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoint = function(a) { + delete this.$breakpoints[a]; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.$detectNewLine = function(a) { + this.$autoNewLine = (a = a.match(/^.*?(\r?\n)/m)) ? a[1] : "\n" + }; + this.tokenRe = /^[\w\d]+/g; + this.nonTokenRe = /^[^\w\d]+/g; + this.getWordRange = function(a, b) { + var c = this.getLine(a), d = false; + if(b > 0) { + d = !!c.charAt(b - 1).match(this.tokenRe) + }d || (d = !!c.charAt(b).match(this.tokenRe)); + d = d ? this.tokenRe : this.nonTokenRe; + var e = b; + if(e > 0) { + do { + e-- + }while(e >= 0 && c.charAt(e).match(d)); + e++ + }for(b = b;b < c.length && c.charAt(b).match(d);) { + b++ + }return new g(a, e, a, b) + }; + this.$getNewLineCharacter = function() { + switch(this.$newLineMode) { + case "windows": + return"\r\n"; + case "unix": + return"\n"; + case "auto": + return this.$autoNewLine + } + }; + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + this.setNewLineMode = function(a) { + if(this.$newLineMode !== a) { + this.$newLineMode = a + } + }; + this.getNewLineMode = function() { + return this.$newLineMode + }; + this.$mode = null; + this.setMode = function(a) { + if(this.$mode !== a) { + this.$mode = a; + this.$dispatchEvent("changeMode") + } + }; + this.getMode = function() { + if(!this.$mode) { + this.$mode = new o + }return this.$mode + }; + this.$scrollTop = 0; + this.setScrollTopRow = function(a) { + if(this.$scrollTop !== a) { + this.$scrollTop = a; + this.$dispatchEvent("changeScrollTop") + } + }; + this.getScrollTopRow = function() { + return this.$scrollTop + }; + this.getWidth = function() { + this.$computeWidth(); + return this.width + }; + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWith + }; + this.$computeWidth = function() { + if(this.modified) { + this.modified = false; + for(var a = this.lines, b = 0, c = 0, d = this.getTabSize(), e = 0;e < a.length;e++) { + var f = a[e].length; + b = Math.max(b, f); + a[e].replace("\t", function(h) { + f += d - 1; + return h + }); + c = Math.max(c, f) + }this.width = b; + this.screenWith = c + } + }; + this.getLine = function(a) { + return this.lines[a] || "" + }; + this.getDisplayLine = function(a) { + var b = (new Array(this.getTabSize() + 1)).join(" "); + return this.lines[a].replace(/\t/g, b) + }; + this.getLines = function(a, b) { + return this.lines.slice(a, b + 1) + }; + this.getLength = function() { + return this.lines.length + }; + this.getTextRange = function(a) { + if(a.start.row == a.end.row) { + return this.lines[a.start.row].substring(a.start.column, a.end.column) + }else { + var b = []; + b.push(this.lines[a.start.row].substring(a.start.column)); + b.push.apply(b, this.getLines(a.start.row + 1, a.end.row - 1)); + b.push(this.lines[a.end.row].substring(0, a.end.column)); + return b.join(this.$getNewLineCharacter()) + } + }; + this.findMatchingBracket = function(a) { + if(a.column == 0) { + return null + }var b = this.getLine(a.row).charAt(a.column - 1); + if(b == "") { + return null + }b = b.match(/([\(\[\{])|([\)\]\}])/); + if(!b) { + return null + }return b[1] ? this.$findClosingBracket(b[1], a) : this.$findOpeningBracket(b[2], a) + }; + this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"}; + this.$findOpeningBracket = function(a, b) { + var c = this.$brackets[a], d = b.column - 2; + b = b.row; + for(var e = 1, f = this.getLine(b);;) { + for(;d >= 0;) { + var h = f.charAt(d); + if(h == c) { + e -= 1; + if(e == 0) { + return{row:b, column:d} + } + }else { + if(h == a) { + e += 1 + } + }d -= 1 + }b -= 1; + if(b < 0) { + break + }f = this.getLine(b); + d = f.length - 1 + }return null + }; + this.$findClosingBracket = function(a, b) { + var c = this.$brackets[a], d = b.column; + b = b.row; + for(var e = 1, f = this.getLine(b), h = this.getLength();;) { + for(;d < f.length;) { + var k = f.charAt(d); + if(k == c) { + e -= 1; + if(e == 0) { + return{row:b, column:d} + } + }else { + if(k == a) { + e += 1 + } + }d += 1 + }b += 1; + if(b >= h) { + break + }f = this.getLine(b); + d = 0 + }return null + }; + this.insert = function(a, b, c) { + b = this.$insert(a, b, c); + this.fireChangeEvent(a.row, a.row == b.row ? a.row : undefined); + return b + }; + this.$insertLines = function(a, b, c) { + if(b.length != 0) { + var d = [a, 0]; + d.push.apply(d, b); + this.lines.splice.apply(this.lines, d); + if(!c && this.$undoManager) { + c = this.$getNewLineCharacter(); + this.$deltas.push({action:"insertText", range:new g(a, 0, a + b.length, 0), text:b.join(c) + c}); + this.$informUndoManager.schedule() + } + } + }; + this.$insert = function(a, b, c) { + if(b.length == 0) { + return a + }this.modified = true; + this.lines.length <= 1 && this.$detectNewLine(b); + var d = this.$split(b); + if(this.$isNewLine(b)) { + var e = this.lines[a.row] || ""; + this.lines[a.row] = e.substring(0, a.column); + this.lines.splice(a.row + 1, 0, e.substring(a.column)); + d = {row:a.row + 1, column:0} + }else { + if(d.length == 1) { + e = this.lines[a.row] || ""; + this.lines[a.row] = e.substring(0, a.column) + b + e.substring(a.column); + d = {row:a.row, column:a.column + b.length} + }else { + e = this.lines[a.row] || ""; + var f = e.substring(0, a.column) + d[0]; + e = d[d.length - 1] + e.substring(a.column); + this.lines[a.row] = f; + this.$insertLines(a.row + 1, [e], true); + d.length > 2 && this.$insertLines(a.row + 1, d.slice(1, -1), true); + d = {row:a.row + d.length - 1, column:d[d.length - 1].length} + } + }if(!c && this.$undoManager) { + this.$deltas.push({action:"insertText", range:g.fromPoints(a, d), text:b}); + this.$informUndoManager.schedule() + }return d + }; + this.$isNewLine = function(a) { + return a == "\r\n" || a == "\r" || a == "\n" + }; + this.remove = function(a, b) { + if(a.isEmpty()) { + return a.start + }this.$remove(a, b); + this.fireChangeEvent(a.start.row, a.isMultiLine() ? undefined : a.start.row); + return a.start + }; + this.$remove = function(a, b) { + if(!a.isEmpty()) { + if(!b && this.$undoManager) { + this.$getNewLineCharacter(); + this.$deltas.push({action:"removeText", range:a.clone(), text:this.getTextRange(a)}); + this.$informUndoManager.schedule() + }this.modified = true; + b = a.start.row; + var c = a.end.row, d = this.getLine(b).substring(0, a.start.column) + this.getLine(c).substring(a.end.column); + this.lines.splice(b, c - b + 1, d); + return a.start + } + }; + this.undoChanges = function(a) { + this.selection.clearSelection(); + for(var b = a.length - 1;b >= 0;b--) { + var c = a[b]; + if(c.action == "insertText") { + this.remove(c.range, true); + this.selection.moveCursorToPosition(c.range.start) + }else { + this.insert(c.range.start, c.text, true); + this.selection.clearSelection() + } + } + }; + this.redoChanges = function(a) { + this.selection.clearSelection(); + for(var b = 0;b < a.length;b++) { + var c = a[b]; + if(c.action == "insertText") { + this.insert(c.range.start, c.text, true); + this.selection.setSelectionRange(c.range) + }else { + this.remove(c.range, true); + this.selection.moveCursorToPosition(c.range.start) + } + } + }; + this.replace = function(a, b) { + this.$remove(a); + b = b ? this.$insert(a.start, b) : a.start; + var c = a.end.column == 0 ? a.end.column - 1 : a.end.column; + this.fireChangeEvent(a.start.row, c == b.row ? c : undefined); + return b + }; + this.indentRows = function(a, b) { + b.replace("\t", this.getTabString()); + for(var c = a.start.row;c <= a.end.row;c++) { + this.$insert({row:c, column:0}, b) + }this.fireChangeEvent(a.start.row, a.end.row); + return b.length + }; + this.outdentRows = function(a) { + for(var b = new g(0, 0, 0, 0), c = this.getTabSize(), d = a.start.row;d <= a.end.row;++d) { + var e = this.getLine(d); + b.start.row = d; + b.end.row = d; + for(var f = 0;f < c;++f) { + if(e.charAt(f) != " ") { + break + } + }if(f < c && e.charAt(f) == "\t") { + b.start.column = f; + b.end.column = f + 1 + }else { + b.start.column = 0; + b.end.column = f + }if(d == a.start.row) { + a.start.column -= b.end.column - b.start.column + }if(d == a.end.row) { + a.end.column -= b.end.column - b.start.column + }this.$remove(b) + }this.fireChangeEvent(a.start.row, a.end.row); + return a + }; + this.moveLinesUp = function(a, b) { + if(a <= 0) { + return 0 + }var c = this.lines.slice(a, b + 1); + this.$remove(new g(a, 0, b + 1, 0)); + this.$insertLines(a - 1, c); + this.fireChangeEvent(a - 1, b); + return-1 + }; + this.moveLinesDown = function(a, b) { + if(b >= this.lines.length - 1) { + return 0 + }var c = this.lines.slice(a, b + 1); + this.$remove(new g(a, 0, b + 1, 0)); + this.$insertLines(a + 1, c); + this.fireChangeEvent(a, b + 1); + return 1 + }; + this.duplicateLines = function(a, b) { + a = this.$clipRowToDocument(a); + b = this.$clipRowToDocument(b); + var c = this.getLines(a, b); + this.$insertLines(a, c); + b = b - a + 1; + this.fireChangeEvent(a); + return b + }; + this.$clipRowToDocument = function(a) { + return Math.max(0, Math.min(a, this.lines.length - 1)) + }; + this.documentToScreenColumn = function(a, b) { + var c = this.getTabSize(), d = 0; + b = b; + a = this.getLine(a).split("\t"); + for(var e = 0;e < a.length;e++) { + var f = a[e].length; + if(b > f) { + b -= f + 1; + d += f + c + }else { + d += b; + break + } + }return d + }; + this.screenToDocumentColumn = function(a, b) { + var c = this.getTabSize(), d = 0; + b = b; + a = this.getLine(a).split("\t"); + for(var e = 0;e < a.length;e++) { + var f = a[e].length; + if(b >= f + c) { + b -= f + c; + d += f + 1 + }else { + d += b > f ? f : b; + break + } + }return d + } + }).call(j.prototype); + return j +}); \ No newline at end of file diff --git a/build/ace/Editor.js b/build/ace/Editor.js new file mode 100644 index 00000000..6eba462a --- /dev/null +++ b/build/ace/Editor.js @@ -0,0 +1,3436 @@ +/* + RequireJS text Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 + LGPLv3 +*/ +(function() { + var k = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], f = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, a = /]*>\s*([\s\S]+)\s*<\/body>/im; + if(!require.textStrip) { + require.textStrip = function(h) { + if(h) { + h = h.replace(f, ""); + var i = h.match(a); + if(i) { + h = i[1] + } + }else { + h = "" + }return h + } + }if(!require.getXhr) { + require.getXhr = function() { + var h, i, e; + if(typeof XMLHttpRequest !== "undefined") { + return new XMLHttpRequest + }else { + for(i = 0;i < 3;i++) { + e = k[i]; + try { + h = new ActiveXObject(e) + }catch(j) { + }if(h) { + k = [e]; + break + } + } + }if(!h) { + throw new Error("require.getXhr(): XMLHttpRequest not available"); + }return h + } + }if(!require.fetchText) { + require.fetchText = function(h, i) { + var e = require.getXhr(); + e.open("GET", h, true); + e.onreadystatechange = function() { + e.readyState === 4 && i(e.responseText) + }; + e.send(null) + } + }require.plugin({prefix:"text", require:function() { + }, newContext:function(h) { + require.mixin(h, {text:{}, textWaiting:[]}) + }, load:function(h, i) { + var e = false, j = null, c, g = h.indexOf("."), l = h.substring(0, g), m = h.substring(g + 1, h.length), b = require.s.contexts[i], d = b.textWaiting; + g = m.indexOf("!"); + if(g !== -1) { + e = m.substring(g + 1, m.length); + m = m.substring(0, g); + g = e.indexOf("!"); + if(g !== -1 && e.substring(0, g) === "strip") { + j = e.substring(g + 1, e.length); + e = "strip" + }else { + if(e !== "strip") { + j = e; + e = null + } + } + }c = l + "!" + m; + g = e ? c + "!" + e : c; + if(j !== null && !b.text[c]) { + b.defined[h] = b.text[c] = j + }else { + if(!b.text[c] && !b.textWaiting[c] && !b.textWaiting[g]) { + d[g] || (d[g] = d[d.push({name:h, key:c, fullKey:g, strip:!!e}) - 1]); + i = require.nameToUrl(l, "." + m, i); + b.loaded[h] = false; + require.fetchText(i, function(n) { + b.text[c] = n; + b.loaded[h] = true + }) + } + } + }, checkDeps:function() { + }, isWaiting:function(h) { + return!!h.textWaiting.length + }, orderDeps:function(h) { + var i, e, j, c = h.textWaiting; + h.textWaiting = []; + for(i = 0;e = c[i];i++) { + j = h.text[e.key]; + h.defined[e.name] = e.strip ? require.textStrip(j) : j + } + }}) +})(); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/oop", function() { + var k = {}; + k.inherits = function(f, a) { + var h = function() { + }; + h.prototype = a.prototype; + f.super_ = a.prototype; + f.prototype = new h; + f.prototype.constructor = f + }; + k.mixin = function(f, a) { + for(var h in a) { + f[h] = a[h] + } + }; + k.implement = function(f, a) { + k.mixin(f, a) + }; + return k +}); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/core", function() { + var k = {}, f = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); + k.isWin = f == "win"; + k.isMac = f == "mac"; + k.isLinux = f == "linux"; + k.isIE = !+"\u000b1"; + k.isGecko = window.controllers && window.navigator.product === "Gecko"; + k.provide = function(a) { + a = a.split("."); + for(var h = window, i = 0;i < a.length;i++) { + var e = a[i]; + h[e] || (h[e] = {}); + h = h[e] + } + }; + return k +}); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/event", ["ace/lib/core"], function(k) { + var f = {}; + f.addListener = function(a, h, i) { + if(a.addEventListener) { + return a.addEventListener(h, i, false) + }if(a.attachEvent) { + var e = function() { + i(window.event) + }; + i.$$wrapper = e; + a.attachEvent("on" + h, e) + } + }; + f.removeListener = function(a, h, i) { + if(a.removeEventListener) { + return a.removeEventListener(h, i, false) + }if(a.detachEvent) { + a.detachEvent("on" + h, i.$$wrapper || i) + } + }; + f.stopEvent = function(a) { + f.stopPropagation(a); + f.preventDefault(a); + return false + }; + f.stopPropagation = function(a) { + if(a.stopPropagation) { + a.stopPropagation() + }else { + a.cancelBubble = true + } + }; + f.preventDefault = function(a) { + if(a.preventDefault) { + a.preventDefault() + }else { + a.returnValue = false + } + }; + f.getDocumentX = function(a) { + return a.clientX ? a.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : a.pageX + }; + f.getDocumentY = function(a) { + return a.clientY ? a.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : a.pageX + }; + f.getButton = function(a) { + return a.preventDefault ? a.button : Math.max(a.button - 1, 2) + }; + f.capture = document.documentElement.setCapture ? function(a, h, i) { + function e(j) { + h && h(j); + i && i(); + f.removeListener(a, "mousemove", h); + f.removeListener(a, "mouseup", e); + f.removeListener(a, "losecapture", e); + a.releaseCapture() + } + f.addListener(a, "mousemove", h); + f.addListener(a, "mouseup", e); + f.addListener(a, "losecapture", e); + a.setCapture() + } : function(a, h, i) { + function e(c) { + h(c); + c.stopPropagation() + } + function j(c) { + h && h(c); + i && i(); + document.removeEventListener("mousemove", e, true); + document.removeEventListener("mouseup", j, true); + c.stopPropagation() + } + document.addEventListener("mousemove", e, true); + document.addEventListener("mouseup", j, true) + }; + f.addMouseWheelListener = function(a, h) { + var i = function(e) { + if(e.wheelDelta !== undefined) { + if(e.wheelDeltaX !== undefined) { + e.wheelX = -e.wheelDeltaX / 8; + e.wheelY = -e.wheelDeltaY / 8 + }else { + e.wheelX = 0; + e.wheelY = -e.wheelDelta / 8 + } + }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 + } + }h(e) + }; + f.addListener(a, "DOMMouseScroll", i); + f.addListener(a, "mousewheel", i) + }; + f.addMultiMouseDownListener = function(a, h, i, e, j) { + var c = 0, g, l, m = function(b) { + c += 1; + if(c == 1) { + g = b.clientX; + l = b.clientY; + setTimeout(function() { + c = 0 + }, e || 600) + }if(f.getButton(b) != h || Math.abs(b.clientX - g) > 5 || Math.abs(b.clientY - l) > 5) { + c = 0 + }if(c == i) { + c = 0; + j(b) + }return f.preventDefault(b) + }; + f.addListener(a, "mousedown", m); + k.isIE && f.addListener(a, "dblclick", m) + }; + f.addKeyListener = function(a, h) { + var i = null; + f.addListener(a, "keydown", function(e) { + i = e.keyIdentifier || e.keyCode; + return h(e) + }); + k.isMac && k.isGecko && f.addListener(a, "keypress", function(e) { + if(i !== (e.keyIdentifier || e.keyCode)) { + return h(e) + }else { + i = null + } + }) + }; + return f +}); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/lang", function() { + var k = {}; + k.stringReverse = function(f) { + return f.split("").reverse().join("") + }; + k.stringRepeat = function(f, a) { + return(new Array(a + 1)).join(f) + }; + k.arrayIndexOf = Array.prototype.indexOf ? function(f, a) { + return f.indexOf(a) + } : function(f, a) { + for(var h = 0;h < f.length;h++) { + if(f[h] == a) { + return h + } + }return-1 + }; + k.isArray = function(f) { + return Object.prototype.toString.call(f) == "[object Array]" + }; + k.copyObject = function(f) { + var a = {}; + for(var h in f) { + a[h] = f[h] + }return a + }; + k.arrayToMap = function(f) { + for(var a = {}, h = 0;h < f.length;h++) { + a[f[h]] = 1 + }return a + }; + k.escapeRegExp = function(f) { + return f.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }; + k.bind = function(f, a) { + return function() { + return f.apply(a, arguments) + } + }; + k.deferredCall = function(f) { + var a = null, h = function() { + a = null; + f() + }; + return{schedule:function() { + a || (a = setTimeout(h, 0)) + }, call:function() { + k.cancel(); + f() + }, cancel:function() { + clearTimeout(a); + a = null + }} + }; + return k +}); +require.def("ace/TextInput", ["ace/lib/event"], function(k) { + return function(f, a) { + function h() { + if(!g) { + var b = i.value; + if(b) { + if(b.charCodeAt(b.length - 1) == j.charCodeAt(0)) { + (b = b.slice(0, -1)) && a.onTextInput(b) + }else { + a.onTextInput(b) + } + } + }g = false; + i.value = j; + i.select() + } + var i = document.createElement("textarea"), e = i.style; + e.position = "absolute"; + e.left = "-10000px"; + e.top = "-10000px"; + f.appendChild(i); + var j = String.fromCharCode(0); + h(); + var c = false, g = false, l = function() { + setTimeout(function() { + c || h() + }, 0) + }, m = function() { + a.onCompositionUpdate(i.value) + }; + k.addListener(i, "keypress", l); + k.addListener(i, "textInput", l); + k.addListener(i, "paste", l); + k.addListener(i, "propertychange", l); + k.addListener(i, "copy", function() { + g = true; + i.value = a.getCopyText(); + i.select(); + g = true; + setTimeout(h, 0) + }); + k.addListener(i, "cut", function() { + g = true; + i.value = a.getCopyText(); + a.onCut(); + i.select(); + setTimeout(h, 0) + }); + k.addListener(i, "compositionstart", function() { + c = true; + h(); + i.value = ""; + a.onCompositionStart(); + setTimeout(m, 0) + }); + k.addListener(i, "compositionupdate", m); + k.addListener(i, "compositionend", function() { + c = false; + a.onCompositionEnd(); + l() + }); + k.addListener(i, "blur", function() { + a.onBlur() + }); + k.addListener(i, "focus", function() { + a.onFocus(); + i.select() + }); + this.focus = function() { + a.onFocus(); + i.select(); + i.focus() + }; + this.blur = function() { + i.blur() + } + } +}); +require.def("ace/conf/keybindings/default_mac", function() { + return{selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down", + selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", + pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); +require.def("ace/conf/keybindings/default_win", function() { + return{selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Ctrl-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Ctrl-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", + selectdown:"Shift-Down", godown:"Down", selectwordleft:"Alt-Shift-Left", gotowordleft:"Alt-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Ctrl-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Alt-Shift-Right", gotowordright:"Alt-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Ctrl-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", + selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); +require.def("ace/PluginManager", [], function() { + return{commands:{}, registerCommand:function(k, f) { + this.commands[k] = f + }} +}); +require.def("ace/commands/DefaultCommands", ["ace/PluginManager"], function(k) { + k.registerCommand("selectall", function(f, a) { + a.selectAll() + }); + k.registerCommand("removeline", function(f) { + f.removeLines() + }); + k.registerCommand("gotoline", function(f) { + var a = parseInt(prompt("Enter line number:")); + isNaN(a) || f.gotoLine(a) + }); + k.registerCommand("togglecomment", function(f) { + f.toggleCommentLines() + }); + k.registerCommand("findnext", function(f) { + f.findNext() + }); + k.registerCommand("findprevious", function(f) { + f.findPrevious() + }); + k.registerCommand("find", function(f) { + var a = prompt("Find:"); + f.find(a) + }); + k.registerCommand("undo", function(f) { + f.undo() + }); + k.registerCommand("redo", function(f) { + f.redo() + }); + k.registerCommand("redo", function(f) { + f.redo() + }); + k.registerCommand("overwrite", function(f) { + f.toggleOverwrite() + }); + k.registerCommand("copylinesup", function(f) { + f.copyLinesUp() + }); + k.registerCommand("movelinesup", function(f) { + f.moveLinesUp() + }); + k.registerCommand("selecttostart", function(f, a) { + a.selectFileStart() + }); + k.registerCommand("gotostart", function(f) { + f.navigateFileStart() + }); + k.registerCommand("selectup", function(f, a) { + a.selectUp() + }); + k.registerCommand("golineup", function(f) { + f.navigateUp() + }); + k.registerCommand("copylinesdown", function(f) { + f.copyLinesDown() + }); + k.registerCommand("movelinesdown", function(f) { + f.moveLinesDown() + }); + k.registerCommand("selecttoend", function(f, a) { + a.selectFileEnd() + }); + k.registerCommand("gotoend", function(f) { + f.navigateFileEnd() + }); + k.registerCommand("selectdown", function(f, a) { + a.selectDown() + }); + k.registerCommand("godown", function(f) { + f.navigateDown() + }); + k.registerCommand("selectwordleft", function(f, a) { + a.selectWordLeft() + }); + k.registerCommand("gotowordleft", function(f) { + f.navigateWordLeft() + }); + k.registerCommand("selecttolinestart", function(f, a) { + a.selectLineStart() + }); + k.registerCommand("gotolinestart", function(f) { + f.navigateLineStart() + }); + k.registerCommand("selectleft", function(f, a) { + a.selectLeft() + }); + k.registerCommand("gotoleft", function(f) { + f.navigateLeft() + }); + k.registerCommand("selectwordright", function(f, a) { + a.selectWordRight() + }); + k.registerCommand("gotowordright", function(f) { + f.navigateWordRight() + }); + k.registerCommand("selecttolineend", function(f, a) { + a.selectLineEnd() + }); + k.registerCommand("gotolineend", function(f) { + f.navigateLineEnd() + }); + k.registerCommand("selectright", function(f, a) { + a.selectRight() + }); + k.registerCommand("gotoright", function(f) { + f.navigateRight() + }); + k.registerCommand("selectpagedown", function(f) { + f.selectPageDown() + }); + k.registerCommand("pagedown", function(f) { + f.scrollPageDown() + }); + k.registerCommand("gotopagedown", function(f) { + f.gotoPageDown() + }); + k.registerCommand("selectpageup", function(f) { + f.selectPageUp() + }); + k.registerCommand("pageup", function(f) { + f.scrollPageUp() + }); + k.registerCommand("gotopageup", function(f) { + f.gotoPageUp() + }); + k.registerCommand("selectlinestart", function(f, a) { + a.selectLineStart() + }); + k.registerCommand("gotolinestart", function(f) { + f.navigateLineStart() + }); + k.registerCommand("selectlineend", function(f, a) { + a.selectLineEnd() + }); + k.registerCommand("gotolineend", function(f) { + f.navigateLineEnd() + }); + k.registerCommand("del", function(f) { + f.removeRight() + }); + k.registerCommand("backspace", function(f) { + f.removeLeft() + }); + k.registerCommand("outdent", function(f) { + f.blockOutdent() + }); + k.registerCommand("indent", function(f) { + f.indent() + }) +}); +require.def("ace/KeyBinding", ["ace/lib/core", "ace/lib/event", "ace/conf/keybindings/default_mac", "ace/conf/keybindings/default_win", "ace/PluginManager", "ace/commands/DefaultCommands"], function(k, f, a, h, i) { + var e = function(j, c, g) { + this.setConfig(g); + var l = this; + f.addKeyListener(j, function(m) { + var b = (l.config.reverse[0 | (m.ctrlKey ? 1 : 0) | (m.altKey ? 2 : 0) | (m.shiftKey ? 4 : 0) | (m.metaKey ? 8 : 0)] || {})[(l.keyNames[m.keyCode] || String.fromCharCode(m.keyCode)).toLowerCase()]; + if(b = i.commands[b]) { + b(c, c.getSelection()); + return f.stopEvent(m) + } + }) + }; + (function() { + function j(l, m, b, d) { + return(d && l.toLowerCase() || l).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + m + "[\\s ]*", "g"), b || 999) + } + function c(l, m, b) { + var d, n = 0; + l = j(l, "\\-", null, true); + for(var o = 0, p = l.length;o < p;++o) { + if(this.keyMods[l[o]]) { + n |= this.keyMods[l[o]] + }else { + d = l[o] || "-" + } + }(b[n] || (b[n] = {}))[d] = m; + return b + } + function g(l, m) { + var b, d, n, o, p = {}; + for(b in l) { + o = l[b]; + if(m && typeof o == "string") { + o = o.split(m); + d = 0; + for(n = o.length;d < n;++d) { + c.call(this, o[d], b, p) + } + }else { + c.call(this, o, b, p) + } + }return p + } + this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8}; + this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"}; + this.setConfig = function(l) { + this.config = l || (k.isMac ? a : h); + if(typeof this.config.reverse == "undefined") { + this.config.reverse = g.call(this, this.config, "|") + } + } + }).call(e.prototype); + return e +}); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/MEventEmitter", ["ace/lib/lang"], function(k) { + var f = {}; + f.$dispatchEvent = function(a, h) { + this.$eventRegistry = this.$eventRegistry || {}; + var i = this.$eventRegistry[a]; + if(i && i.length) { + h = h || {}; + h.type = a; + for(a = 0;a < i.length;a++) { + i[a](h) + } + } + }; + f.on = f.addEventListener = function(a, h) { + this.$eventRegistry = this.$eventRegistry || {}; + var i = this.$eventRegistry[a]; + i || (i = this.$eventRegistry[a] = []); + k.arrayIndexOf(i, h) == -1 && i.push(h) + }; + f.removeEventListener = function(a, h) { + this.$eventRegistry = this.$eventRegistry || {}; + if(a = this.$eventRegistry[a]) { + h = k.arrayIndexOf(a, h); + h !== -1 && a.splice(h, 1) + } + }; + return f +}); +require.def("ace/Range", function() { + var k = function(f, a, h, i) { + this.start = {row:f, column:a}; + this.end = {row:h, column:i} + }; + (function() { + this.toString = function() { + return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]" + }; + this.contains = function(f, a) { + return this.compare(f, a) == 0 + }; + this.compare = function(f, a) { + if(!this.isMultiLine()) { + if(f === this.start.row) { + return a < this.start.column ? -1 : a > this.end.column ? 1 : 0 + } + }if(f < this.start.row) { + return-1 + }if(f > this.end.row) { + return 1 + }if(this.start.row === f) { + return a >= this.start.column ? 0 : -1 + }if(this.end.row === f) { + return a <= this.end.column ? 0 : 1 + }return 0 + }; + this.clipRows = function(f, a) { + if(this.end.row > a) { + var h = {row:a + 1, column:0} + }if(this.start.row > a) { + var i = {row:a + 1, column:0} + }if(this.start.row < f) { + i = {row:f, column:0} + }if(this.end.row < f) { + h = {row:f, column:0} + }return k.fromPoints(i || this.start, h || this.end) + }; + this.extend = function(f, a) { + var h = this.compare(f, a); + if(h == 0) { + return this + }else { + if(h == -1) { + var i = {row:f, column:a} + }else { + var e = {row:f, column:a} + } + }return k.fromPoints(i || this.start, e || this.end) + }; + this.isEmpty = function() { + return this.start.row == this.end.row && this.start.column == this.end.column + }; + this.isMultiLine = function() { + return this.start.row !== this.end.row + }; + this.clone = function() { + return k.fromPoints(this.start, this.end) + }; + this.toScreenRange = function(f) { + return new k(this.start.row, f.documentToScreenColumn(this.start.row, this.start.column), this.end.row, f.documentToScreenColumn(this.end.row, this.end.column)) + } + }).call(k.prototype); + k.fromPoints = function(f, a) { + return new k(f.row, f.column, a.row, a.column) + }; + return k +}); +require.def("ace/Selection", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Range"], function(k, f, a, h) { + var i = function(e) { + this.doc = e; + this.clearSelection(); + this.selectionLead = {row:0, column:0} + }; + (function() { + k.implement(this, a); + this.isEmpty = function() { + return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column + }; + this.isMultiLine = function() { + if(this.isEmpty()) { + return false + }return this.getRange().isMultiLine() + }; + this.getCursor = function() { + return this.selectionLead + }; + this.setSelectionAnchor = function(e, j) { + e = this.$clipPositionToDocument(e, j); + if(this.selectionAnchor) { + if(this.selectionAnchor.row !== e.row || this.selectionAnchor.column !== e.column) { + this.selectionAnchor = e; + this.$dispatchEvent("changeSelection", {}) + } + }else { + this.selectionAnchor = e; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.getSelectionAnchor = function() { + return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead) + }; + this.getSelectionLead = function() { + return this.$clone(this.selectionLead) + }; + this.shiftSelection = function(e) { + if(this.isEmpty()) { + this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + e) + }else { + var j = this.getSelectionAnchor(), c = this.getSelectionLead(), g = this.isBackwards(); + if(!g || j.column !== 0) { + this.setSelectionAnchor(j.row, j.column + e) + }if(g || c.column !== 0) { + this.$moveSelection(function() { + this.moveCursorTo(c.row, c.column + e) + }) + } + } + }; + this.isBackwards = function() { + var e = this.selectionAnchor || this.selectionLead, j = this.selectionLead; + return e.row > j.row || e.row == j.row && e.column > j.column + }; + this.getRange = function() { + var e = this.selectionAnchor || this.selectionLead, j = this.selectionLead; + return this.isBackwards() ? h.fromPoints(j, e) : h.fromPoints(e, j) + }; + this.clearSelection = function() { + if(this.selectionAnchor) { + this.selectionAnchor = null; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.selectAll = function() { + var e = this.doc.getLength() - 1; + this.setSelectionAnchor(e, this.doc.getLine(e).length); + this.$moveSelection(function() { + this.moveCursorTo(0, 0) + }) + }; + this.setSelectionRange = function(e, j) { + if(j) { + this.setSelectionAnchor(e.end.row, e.end.column); + this.selectTo(e.start.row, e.start.column) + }else { + this.setSelectionAnchor(e.start.row, e.start.column); + this.selectTo(e.end.row, e.end.column) + } + }; + this.$moveSelection = function(e) { + var j = false; + if(!this.selectionAnchor) { + j = true; + this.selectionAnchor = this.$clone(this.selectionLead) + }var c = this.$clone(this.selectionLead); + e.call(this); + if(c.row !== this.selectionLead.row || c.column !== this.selectionLead.column) { + j = true + }j && this.$dispatchEvent("changeSelection", {}) + }; + this.selectTo = function(e, j) { + this.$moveSelection(function() { + this.moveCursorTo(e, j) + }) + }; + this.selectToPosition = function(e) { + this.$moveSelection(function() { + this.moveCursorToPosition(e) + }) + }; + this.selectUp = function() { + this.$moveSelection(this.moveCursorUp) + }; + this.selectDown = function() { + this.$moveSelection(this.moveCursorDown) + }; + this.selectRight = function() { + this.$moveSelection(this.moveCursorRight) + }; + this.selectLeft = function() { + this.$moveSelection(this.moveCursorLeft) + }; + this.selectLineStart = function() { + this.$moveSelection(this.moveCursorLineStart) + }; + this.selectLineEnd = function() { + this.$moveSelection(this.moveCursorLineEnd) + }; + this.selectFileEnd = function() { + this.$moveSelection(this.moveCursorFileEnd) + }; + this.selectFileStart = function() { + this.$moveSelection(this.moveCursorFileStart) + }; + this.selectWordRight = function() { + this.$moveSelection(this.moveCursorWordRight) + }; + this.selectWordLeft = function() { + this.$moveSelection(this.moveCursorWordLeft) + }; + this.selectWord = function() { + var e = this.selectionLead; + this.setSelectionRange(this.doc.getWordRange(e.row, e.column)) + }; + this.selectLine = function() { + this.setSelectionAnchor(this.selectionLead.row, 0); + this.$moveSelection(function() { + this.moveCursorTo(this.selectionLead.row + 1, 0) + }) + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.moveCursorDown = function() { + this.moveCursorBy(1, 0) + }; + this.moveCursorLeft = function() { + if(this.selectionLead.column == 0) { + this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length) + }else { + this.moveCursorBy(0, -1) + } + }; + this.moveCursorRight = function() { + if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { + this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0) + }else { + this.moveCursorBy(0, 1) + } + }; + this.moveCursorLineStart = function() { + var e = this.selectionLead.row, j = this.selectionLead.column, c = this.doc.getLine(e).slice(0, j).match(/^\s*/); + if(c[0].length == 0) { + this.moveCursorTo(e, this.doc.getLine(e).match(/^\s*/)[0].length) + }else { + c[0].length >= j ? this.moveCursorTo(e, 0) : this.moveCursorTo(e, c[0].length) + } + }; + this.moveCursorLineEnd = function() { + this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length) + }; + this.moveCursorFileEnd = function() { + var e = this.doc.getLength() - 1, j = this.doc.getLine(e).length; + this.moveCursorTo(e, j) + }; + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0) + }; + this.moveCursorWordRight = function() { + var e = this.selectionLead.row, j = this.selectionLead.column, c = this.doc.getLine(e), g = c.substring(j); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(j == c.length) { + this.moveCursorRight() + }else { + if(this.doc.nonTokenRe.exec(g)) { + j += this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(g)) { + j += this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(e, j) + } + }; + this.moveCursorWordLeft = function() { + var e = this.selectionLead.row, j = this.selectionLead.column, c = this.doc.getLine(e); + c = f.stringReverse(c.substring(0, j)); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(j == 0) { + this.moveCursorLeft() + }else { + if(this.doc.nonTokenRe.exec(c)) { + j -= this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(c)) { + j -= this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(e, j) + } + }; + this.moveCursorBy = function(e, j) { + this.moveCursorTo(this.selectionLead.row + e, this.selectionLead.column + j) + }; + this.moveCursorToPosition = function(e) { + this.moveCursorTo(e.row, e.column) + }; + this.moveCursorTo = function(e, j) { + e = this.$clipPositionToDocument(e, j); + if(e.row !== this.selectionLead.row || e.column !== this.selectionLead.column) { + this.selectionLead = e; + this.$dispatchEvent("changeCursor", {data:this.getCursor()}) + } + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.$clipPositionToDocument = function(e, j) { + var c = {}; + if(e >= this.doc.getLength()) { + c.row = Math.max(0, this.doc.getLength() - 1); + c.column = this.doc.getLine(c.row).length + }else { + if(e < 0) { + c.row = 0; + c.column = 0 + }else { + c.row = e; + c.column = Math.min(this.doc.getLine(c.row).length, Math.max(0, j)) + } + }return c + }; + this.$clone = function(e) { + return{row:e.row, column:e.column} + } + }).call(i.prototype); + return i +}); +require.def("ace/Tokenizer", [], function() { + var k = function(f) { + this.rules = f; + this.regExps = {}; + for(var a in this.rules) { + f = this.rules[a]; + for(var h = [], i = 0;i < f.length;i++) { + h.push(f[i].regex) + }this.regExps[a] = new RegExp("(?:(" + h.join(")|(") + ")|(.))", "g") + } + }; + (function() { + this.getLineTokens = function(f, a) { + a = a; + var h = this.rules[a], i = this.regExps[a]; + i.lastIndex = 0; + for(var e, j = [], c = 0, g = {type:null, value:""};e = i.exec(f);) { + var l = "text", m = e[0]; + if(i.lastIndex == c) { + throw new Error("tokenizer error"); + }c = i.lastIndex; + window.LOG && console.log(a, e); + for(var b = 0;b < h.length;b++) { + if(e[b + 1]) { + l = typeof h[b].token == "function" ? h[b].token(e[0]) : h[b].token; + if(h[b].next && h[b].next !== a) { + a = h[b].next; + h = this.rules[a]; + c = i.lastIndex; + i = this.regExps[a]; + i.lastIndex = c + }break + } + }if(g.type !== l) { + g.type && j.push(g); + g = {type:l, value:m} + }else { + g.value += m + } + }g.type && j.push(g); + window.LOG && console.log(j, a); + return{tokens:j, state:a} + } + }).call(k.prototype); + return k +}); +require.def("ace/mode/TextHighlightRules", [], function() { + var k = function() { + this.$rules = {start:[{token:"text", regex:".+"}]} + }; + (function() { + this.addRules = function(f, a) { + for(var h in f) { + for(var i = f[h], e = 0;e < i.length;e++) { + var j = i[e]; + j.next = j.next ? a + j.next : a + h + }this.$rules[a + h] = i + } + }; + this.getRules = function() { + return this.$rules + } + }).call(k.prototype); + return k +}); +require.def("ace/mode/Text", ["ace/Tokenizer", "ace/mode/TextHighlightRules"], function(k, f) { + var a = function() { + this.$tokenizer = new k((new f).getRules()) + }; + (function() { + this.getTokenizer = function() { + return this.$tokenizer + }; + this.toggleCommentLines = function() { + return 0 + }; + this.getNextLineIndent = function() { + return"" + }; + this.checkOutdent = function() { + return false + }; + this.autoOutdent = function() { + }; + this.$getIndent = function(h) { + if(h = h.match(/^(\s+)/)) { + return h[1] + }return"" + } + }).call(a.prototype); + return a +}); +require.def("ace/Document", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Selection", "ace/mode/Text", "ace/Range"], function(k, f, a, h, i, e) { + var j = function(c, g) { + this.modified = true; + this.lines = []; + this.selection = new h(this); + this.$breakpoints = []; + this.listeners = []; + g && this.setMode(g); + f.isArray(c) ? this.$insertLines(0, c) : this.$insert({row:0, column:0}, c) + }; + (function() { + k.implement(this, a); + this.$undoManager = null; + this.$split = function(c) { + return c.split(/\r\n|\r|\n/) + }; + this.setValue = function(c) { + var g = [0, this.lines.length]; + g.push.apply(g, this.$split(c)); + this.lines.splice.apply(this.lines, g); + this.modified = true; + this.fireChangeEvent(0) + }; + this.toString = function() { + return this.lines.join(this.$getNewLineCharacter()) + }; + this.getSelection = function() { + return this.selection + }; + this.fireChangeEvent = function(c, g) { + this.$dispatchEvent("change", {data:{firstRow:c, lastRow:g}}) + }; + this.setUndoManager = function(c) { + this.$undoManager = c; + this.$deltas = []; + this.$informUndoManager && this.$informUndoManager.cancel(); + if(c) { + var g = this; + this.$informUndoManager = f.deferredCall(function() { + g.$deltas.length > 0 && c.execute({action:"aceupdate", args:[g.$deltas, g]}); + g.$deltas = [] + }) + } + }; + this.$defaultUndoManager = {undo:function() { + }, redo:function() { + }}; + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager + }; + this.getTabString = function() { + return this.getUseSoftTabs() ? f.stringRepeat(" ", this.getTabSize()) : "\t" + }; + this.$useSoftTabs = true; + this.setUseSoftTabs = function(c) { + if(this.$useSoftTabs !== c) { + this.$useSoftTabs = c + } + }; + this.getUseSoftTabs = function() { + return this.$useSoftTabs + }; + this.$tabSize = 4; + this.setTabSize = function(c) { + if(!(isNaN(c) || this.$tabSize === c)) { + this.modified = true; + this.$tabSize = c; + this.$dispatchEvent("changeTabSize") + } + }; + this.getTabSize = function() { + return this.$tabSize + }; + this.getBreakpoints = function() { + return this.$breakpoints + }; + this.setBreakpoints = function(c) { + this.$breakpoints = []; + for(var g = 0;g < c.length;g++) { + this.$breakpoints[c[g]] = true + }this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoints = function() { + this.$breakpoints = []; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.setBreakpoint = function(c) { + this.$breakpoints[c] = true; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.clearBreakpoint = function(c) { + delete this.$breakpoints[c]; + this.$dispatchEvent("changeBreakpoint", {}) + }; + this.$detectNewLine = function(c) { + this.$autoNewLine = (c = c.match(/^.*?(\r?\n)/m)) ? c[1] : "\n" + }; + this.tokenRe = /^[\w\d]+/g; + this.nonTokenRe = /^[^\w\d]+/g; + this.getWordRange = function(c, g) { + var l = this.getLine(c), m = false; + if(g > 0) { + m = !!l.charAt(g - 1).match(this.tokenRe) + }m || (m = !!l.charAt(g).match(this.tokenRe)); + m = m ? this.tokenRe : this.nonTokenRe; + var b = g; + if(b > 0) { + do { + b-- + }while(b >= 0 && l.charAt(b).match(m)); + b++ + }for(g = g;g < l.length && l.charAt(g).match(m);) { + g++ + }return new e(c, b, c, g) + }; + this.$getNewLineCharacter = function() { + switch(this.$newLineMode) { + case "windows": + return"\r\n"; + case "unix": + return"\n"; + case "auto": + return this.$autoNewLine + } + }; + this.$autoNewLine = "\n"; + this.$newLineMode = "auto"; + this.setNewLineMode = function(c) { + if(this.$newLineMode !== c) { + this.$newLineMode = c + } + }; + this.getNewLineMode = function() { + return this.$newLineMode + }; + this.$mode = null; + this.setMode = function(c) { + if(this.$mode !== c) { + this.$mode = c; + this.$dispatchEvent("changeMode") + } + }; + this.getMode = function() { + if(!this.$mode) { + this.$mode = new i + }return this.$mode + }; + this.$scrollTop = 0; + this.setScrollTopRow = function(c) { + if(this.$scrollTop !== c) { + this.$scrollTop = c; + this.$dispatchEvent("changeScrollTop") + } + }; + this.getScrollTopRow = function() { + return this.$scrollTop + }; + this.getWidth = function() { + this.$computeWidth(); + return this.width + }; + this.getScreenWidth = function() { + this.$computeWidth(); + return this.screenWith + }; + this.$computeWidth = function() { + if(this.modified) { + this.modified = false; + for(var c = this.lines, g = 0, l = 0, m = this.getTabSize(), b = 0;b < c.length;b++) { + var d = c[b].length; + g = Math.max(g, d); + c[b].replace("\t", function(n) { + d += m - 1; + return n + }); + l = Math.max(l, d) + }this.width = g; + this.screenWith = l + } + }; + this.getLine = function(c) { + return this.lines[c] || "" + }; + this.getDisplayLine = function(c) { + var g = (new Array(this.getTabSize() + 1)).join(" "); + return this.lines[c].replace(/\t/g, g) + }; + this.getLines = function(c, g) { + return this.lines.slice(c, g + 1) + }; + this.getLength = function() { + return this.lines.length + }; + this.getTextRange = function(c) { + if(c.start.row == c.end.row) { + return this.lines[c.start.row].substring(c.start.column, c.end.column) + }else { + var g = []; + g.push(this.lines[c.start.row].substring(c.start.column)); + g.push.apply(g, this.getLines(c.start.row + 1, c.end.row - 1)); + g.push(this.lines[c.end.row].substring(0, c.end.column)); + return g.join(this.$getNewLineCharacter()) + } + }; + this.findMatchingBracket = function(c) { + if(c.column == 0) { + return null + }var g = this.getLine(c.row).charAt(c.column - 1); + if(g == "") { + return null + }g = g.match(/([\(\[\{])|([\)\]\}])/); + if(!g) { + return null + }return g[1] ? this.$findClosingBracket(g[1], c) : this.$findOpeningBracket(g[2], c) + }; + this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"}; + this.$findOpeningBracket = function(c, g) { + var l = this.$brackets[c], m = g.column - 2; + g = g.row; + for(var b = 1, d = this.getLine(g);;) { + for(;m >= 0;) { + var n = d.charAt(m); + if(n == l) { + b -= 1; + if(b == 0) { + return{row:g, column:m} + } + }else { + if(n == c) { + b += 1 + } + }m -= 1 + }g -= 1; + if(g < 0) { + break + }d = this.getLine(g); + m = d.length - 1 + }return null + }; + this.$findClosingBracket = function(c, g) { + var l = this.$brackets[c], m = g.column; + g = g.row; + for(var b = 1, d = this.getLine(g), n = this.getLength();;) { + for(;m < d.length;) { + var o = d.charAt(m); + if(o == l) { + b -= 1; + if(b == 0) { + return{row:g, column:m} + } + }else { + if(o == c) { + b += 1 + } + }m += 1 + }g += 1; + if(g >= n) { + break + }d = this.getLine(g); + m = 0 + }return null + }; + this.insert = function(c, g, l) { + g = this.$insert(c, g, l); + this.fireChangeEvent(c.row, c.row == g.row ? c.row : undefined); + return g + }; + this.$insertLines = function(c, g, l) { + if(g.length != 0) { + var m = [c, 0]; + m.push.apply(m, g); + this.lines.splice.apply(this.lines, m); + if(!l && this.$undoManager) { + l = this.$getNewLineCharacter(); + this.$deltas.push({action:"insertText", range:new e(c, 0, c + g.length, 0), text:g.join(l) + l}); + this.$informUndoManager.schedule() + } + } + }; + this.$insert = function(c, g, l) { + if(g.length == 0) { + return c + }this.modified = true; + this.lines.length <= 1 && this.$detectNewLine(g); + var m = this.$split(g); + if(this.$isNewLine(g)) { + var b = this.lines[c.row] || ""; + this.lines[c.row] = b.substring(0, c.column); + this.lines.splice(c.row + 1, 0, b.substring(c.column)); + m = {row:c.row + 1, column:0} + }else { + if(m.length == 1) { + b = this.lines[c.row] || ""; + this.lines[c.row] = b.substring(0, c.column) + g + b.substring(c.column); + m = {row:c.row, column:c.column + g.length} + }else { + b = this.lines[c.row] || ""; + var d = b.substring(0, c.column) + m[0]; + b = m[m.length - 1] + b.substring(c.column); + this.lines[c.row] = d; + this.$insertLines(c.row + 1, [b], true); + m.length > 2 && this.$insertLines(c.row + 1, m.slice(1, -1), true); + m = {row:c.row + m.length - 1, column:m[m.length - 1].length} + } + }if(!l && this.$undoManager) { + this.$deltas.push({action:"insertText", range:e.fromPoints(c, m), text:g}); + this.$informUndoManager.schedule() + }return m + }; + this.$isNewLine = function(c) { + return c == "\r\n" || c == "\r" || c == "\n" + }; + this.remove = function(c, g) { + if(c.isEmpty()) { + return c.start + }this.$remove(c, g); + this.fireChangeEvent(c.start.row, c.isMultiLine() ? undefined : c.start.row); + return c.start + }; + this.$remove = function(c, g) { + if(!c.isEmpty()) { + if(!g && this.$undoManager) { + this.$getNewLineCharacter(); + this.$deltas.push({action:"removeText", range:c.clone(), text:this.getTextRange(c)}); + this.$informUndoManager.schedule() + }this.modified = true; + g = c.start.row; + var l = c.end.row, m = this.getLine(g).substring(0, c.start.column) + this.getLine(l).substring(c.end.column); + this.lines.splice(g, l - g + 1, m); + return c.start + } + }; + this.undoChanges = function(c) { + this.selection.clearSelection(); + for(var g = c.length - 1;g >= 0;g--) { + var l = c[g]; + if(l.action == "insertText") { + this.remove(l.range, true); + this.selection.moveCursorToPosition(l.range.start) + }else { + this.insert(l.range.start, l.text, true); + this.selection.clearSelection() + } + } + }; + this.redoChanges = function(c) { + this.selection.clearSelection(); + for(var g = 0;g < c.length;g++) { + var l = c[g]; + if(l.action == "insertText") { + this.insert(l.range.start, l.text, true); + this.selection.setSelectionRange(l.range) + }else { + this.remove(l.range, true); + this.selection.moveCursorToPosition(l.range.start) + } + } + }; + this.replace = function(c, g) { + this.$remove(c); + g = g ? this.$insert(c.start, g) : c.start; + var l = c.end.column == 0 ? c.end.column - 1 : c.end.column; + this.fireChangeEvent(c.start.row, l == g.row ? l : undefined); + return g + }; + this.indentRows = function(c, g) { + g.replace("\t", this.getTabString()); + for(var l = c.start.row;l <= c.end.row;l++) { + this.$insert({row:l, column:0}, g) + }this.fireChangeEvent(c.start.row, c.end.row); + return g.length + }; + this.outdentRows = function(c) { + for(var g = new e(0, 0, 0, 0), l = this.getTabSize(), m = c.start.row;m <= c.end.row;++m) { + var b = this.getLine(m); + g.start.row = m; + g.end.row = m; + for(var d = 0;d < l;++d) { + if(b.charAt(d) != " ") { + break + } + }if(d < l && b.charAt(d) == "\t") { + g.start.column = d; + g.end.column = d + 1 + }else { + g.start.column = 0; + g.end.column = d + }if(m == c.start.row) { + c.start.column -= g.end.column - g.start.column + }if(m == c.end.row) { + c.end.column -= g.end.column - g.start.column + }this.$remove(g) + }this.fireChangeEvent(c.start.row, c.end.row); + return c + }; + this.moveLinesUp = function(c, g) { + if(c <= 0) { + return 0 + }var l = this.lines.slice(c, g + 1); + this.$remove(new e(c, 0, g + 1, 0)); + this.$insertLines(c - 1, l); + this.fireChangeEvent(c - 1, g); + return-1 + }; + this.moveLinesDown = function(c, g) { + if(g >= this.lines.length - 1) { + return 0 + }var l = this.lines.slice(c, g + 1); + this.$remove(new e(c, 0, g + 1, 0)); + this.$insertLines(c + 1, l); + this.fireChangeEvent(c, g + 1); + return 1 + }; + this.duplicateLines = function(c, g) { + c = this.$clipRowToDocument(c); + g = this.$clipRowToDocument(g); + var l = this.getLines(c, g); + this.$insertLines(c, l); + g = g - c + 1; + this.fireChangeEvent(c); + return g + }; + this.$clipRowToDocument = function(c) { + return Math.max(0, Math.min(c, this.lines.length - 1)) + }; + this.documentToScreenColumn = function(c, g) { + var l = this.getTabSize(), m = 0; + g = g; + c = this.getLine(c).split("\t"); + for(var b = 0;b < c.length;b++) { + var d = c[b].length; + if(g > d) { + g -= d + 1; + m += d + l + }else { + m += g; + break + } + }return m + }; + this.screenToDocumentColumn = function(c, g) { + var l = this.getTabSize(), m = 0; + g = g; + c = this.getLine(c).split("\t"); + for(var b = 0;b < c.length;b++) { + var d = c[b].length; + if(g >= d + l) { + g -= d + l; + m += d + 1 + }else { + m += g > d ? d : g; + break + } + }return m + } + }).call(j.prototype); + return j +}); +require.def("ace/Search", ["ace/lib/lang", "ace/lib/oop", "ace/Range"], function(k, f, a) { + var h = function() { + this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:h.ALL, regExp:false} + }; + h.ALL = 1; + h.SELECTION = 2; + (function() { + this.set = function(i) { + f.mixin(this.$options, i); + return this + }; + this.getOptions = function() { + return k.copyObject(this.$options) + }; + this.find = function(i) { + if(!this.$options.needle) { + return null + }var e = null; + (this.$options.backwards ? this.$backwardMatchIterator(i) : this.$forwardMatchIterator(i)).forEach(function(j) { + e = j; + return true + }); + return e + }; + this.findAll = function(i) { + if(!this.$options.needle) { + return[] + }var e = []; + (this.$options.backwards ? this.$backwardMatchIterator(i) : this.$forwardMatchIterator(i)).forEach(function(j) { + e.push(j) + }); + return e + }; + this.replace = function(i, e) { + var j = this.$assembleRegExp(), c = j.exec(i); + return c && c[0].length == i.length ? this.$options.regExp ? i.replace(j, e) : e : null + }; + this.$forwardMatchIterator = function(i) { + var e = this.$assembleRegExp(), j = this; + return{forEach:function(c) { + j.$forwardLineIterator(i).forEach(function(g, l, m) { + if(l) { + g = g.substring(l) + }var b = []; + g.replace(e, function(n) { + b.push({str:n, offset:l + arguments[arguments.length - 2]}); + return n + }); + for(g = 0;g < b.length;g++) { + var d = b[g]; + d = j.$rangeFromMatch(m, d.offset, d.str.length); + if(c(d)) { + return true + } + } + }) + }} + }; + this.$backwardMatchIterator = function(i) { + var e = this.$assembleRegExp(), j = this; + return{forEach:function(c) { + j.$backwardLineIterator(i).forEach(function(g, l, m) { + if(l) { + g = g.substring(l) + }var b = []; + g.replace(e, function(n, o) { + b.push({str:n, offset:l + o}); + return n + }); + for(g = b.length - 1;g >= 0;g--) { + var d = b[g]; + d = j.$rangeFromMatch(m, d.offset, d.str.length); + if(c(d)) { + return true + } + } + }) + }} + }; + this.$rangeFromMatch = function(i, e, j) { + return new a(i, e, i, e + j) + }; + this.$assembleRegExp = function() { + var i = this.$options.regExp ? this.$options.needle : k.escapeRegExp(this.$options.needle); + if(this.$options.wholeWord) { + i = "\\b" + i + "\\b" + }var e = "g"; + this.$options.caseSensitive || (e += "i"); + return new RegExp(i, e) + }; + this.$forwardLineIterator = function(i) { + function e(n) { + var o = i.getLine(n); + if(j && n == c.end.row) { + o = o.substring(0, c.end.column) + }return o + } + var j = this.$options.scope == h.SELECTION, c = i.getSelection().getRange(), g = i.getSelection().getCursor(), l = j ? c.start.row : 0, m = j ? c.start.column : 0, b = j ? c.end.row : i.getLength() - 1, d = this.$options.wrap; + return{forEach:function(n) { + for(var o = g.row, p = e(o), r = g.column, q = false;!n(p, r, o);) { + if(q) { + return + }o++; + r = 0; + if(o > b) { + if(d) { + o = l; + r = m + }else { + return + } + }if(o == g.row) { + q = true + }p = e(o) + } + }} + }; + this.$backwardLineIterator = function(i) { + var e = this.$options.scope == h.SELECTION, j = i.getSelection().getRange(), c = e ? j.end : j.start, g = e ? j.start.row : 0, l = e ? j.start.column : 0, m = e ? j.end.row : i.getLength() - 1, b = this.$options.wrap; + return{forEach:function(d) { + for(var n = c.row, o = i.getLine(n).substring(0, c.column), p = 0, r = false;!d(o, p, n);) { + if(r) { + return + }n--; + p = 0; + if(n < g) { + if(b) { + n = m + }else { + return + } + }if(n == c.row) { + r = true + }o = i.getLine(n); + if(e) { + if(n == g) { + p = l + }else { + if(n == m) { + o = o.substring(0, j.end.column) + } + } + } + } + }} + } + }).call(h.prototype); + return h +}); +require.def("ace/BackgroundTokenizer", ["ace/lib/oop", "ace/MEventEmitter"], function(k, f) { + var a = function(h, i) { + this.running = false; + this.textLines = []; + this.lines = []; + this.currentLine = 0; + this.tokenizer = h; + var e = this; + this.$worker = function() { + if(e.running) { + for(var j = new Date, c = e.currentLine, g = e.textLines, l = 0, m = i.getLastVisibleRow();e.currentLine < g.length;) { + e.lines[e.currentLine] = e.$tokenizeRows(e.currentLine, e.currentLine)[0]; + e.currentLine++; + l += 1; + if(l % 5 == 0 && new Date - j > 20) { + e.fireUpdateEvent(c, e.currentLine - 1); + e.running = setTimeout(e.$worker, e.currentLine < m ? 20 : 100); + return + } + }e.running = false; + e.fireUpdateEvent(c, g.length - 1) + } + } + }; + (function() { + k.implement(this, f); + this.setTokenizer = function(h) { + this.tokenizer = h; + this.lines = []; + this.start(0) + }; + this.setLines = function(h) { + this.textLines = h; + this.lines = []; + this.stop() + }; + this.fireUpdateEvent = function(h, i) { + this.$dispatchEvent("update", {data:{first:h, last:i}}) + }; + this.start = function(h) { + this.currentLine = Math.min(h || 0, this.currentLine, this.textLines.length); + this.lines.splice(this.currentLine, this.lines.length); + this.stop(); + this.running = setTimeout(this.$worker, 700) + }; + this.stop = function() { + this.running && clearTimeout(this.running); + this.running = false + }; + this.getTokens = function(h, i, e) { + e(this.$tokenizeRows(h, i)) + }; + this.getState = function(h, i) { + i(this.$tokenizeRows(h, h)[0].state) + }; + this.$tokenizeRows = function(h, i) { + var e = [], j = "start", c = false; + if(h > 0 && this.lines[h - 1]) { + j = this.lines[h - 1].state; + c = true + }for(h = h;h <= i;h++) { + if(this.lines[h]) { + g = this.lines[h]; + j = g.state; + e.push(g) + }else { + var g = this.tokenizer.getLineTokens(this.textLines[h] || "", j); + j = g.state; + e.push(g); + if(c) { + this.lines[h] = g + } + } + }return e + } + }).call(a.prototype); + return a +}); +require.def("ace/Editor", ["ace/lib/oop", "ace/lib/event", "ace/lib/lang", "ace/TextInput", "ace/KeyBinding", "ace/Document", "ace/Search", "ace/BackgroundTokenizer", "ace/Range", "ace/MEventEmitter"], function(k, f, a, h, i, e, j, c, g, l) { + var m = function(b, d) { + var n = b.getContainerElement(); + this.container = n; + this.renderer = b; + this.textInput = new h(n, this); + this.keyBinding = new i(n, this); + var o = this; + f.addListener(n, "mousedown", function(p) { + setTimeout(function() { + o.focus() + }); + return f.preventDefault(p) + }); + f.addListener(n, "selectstart", function(p) { + return f.preventDefault(p) + }); + b = b.getMouseEventTarget(); + f.addListener(b, "mousedown", a.bind(this.onMouseDown, this)); + f.addMultiMouseDownListener(b, 0, 2, 500, a.bind(this.onMouseDoubleClick, this)); + f.addMultiMouseDownListener(b, 0, 3, 600, a.bind(this.onMouseTripleClick, this)); + f.addMouseWheelListener(b, a.bind(this.onMouseWheel, this)); + this.$highlightLineMarker = this.$selectionMarker = null; + this.$blockScrolling = false; + this.$search = (new j).set({wrap:true}); + this.setDocument(d || new e("")); + this.focus() + }; + (function() { + k.implement(this, l); + this.$forwardEvents = {gutterclick:1, gutterdblclick:1}; + this.$originalAddEventListener = this.addEventListener; + this.$originalRemoveEventListener = this.removeEventListener; + this.addEventListener = function(b, d) { + return this.$forwardEvents[b] ? this.renderer.addEventListener(b, d) : this.$originalAddEventListener(b, d) + }; + this.removeEventListener = function(b, d) { + return this.$forwardEvents[b] ? this.renderer.removeEventListener(b, d) : this.$originalRemoveEventListener(b, d) + }; + this.setDocument = function(b) { + if(this.doc != b) { + if(this.doc) { + this.doc.removeEventListener("change", this.$onDocumentChange); + this.doc.removeEventListener("changeMode", this.$onDocumentModeChange); + this.doc.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize); + this.doc.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + var d = this.doc.getSelection(); + d.removeEventListener("changeCursor", this.$onCursorChange); + d.removeEventListener("changeSelection", this.$onSelectionChange); + this.doc.setScrollTopRow(this.renderer.getScrollTopRow()) + }this.doc = b; + this.$onDocumentChange = a.bind(this.onDocumentChange, this); + b.addEventListener("change", this.$onDocumentChange); + this.renderer.setDocument(b); + this.$onDocumentModeChange = a.bind(this.onDocumentModeChange, this); + b.addEventListener("changeMode", this.$onDocumentModeChange); + this.$onDocumentChangeTabSize = a.bind(this.renderer.updateText, this.renderer); + b.addEventListener("changeTabSize", this.$onDocumentChangeTabSize); + this.$onDocumentChangeBreakpoint = a.bind(this.onDocumentChangeBreakpoint, this); + this.doc.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint); + this.selection = b.getSelection(); + this.$desiredColumn = 0; + this.$onCursorChange = a.bind(this.onCursorChange, this); + this.selection.addEventListener("changeCursor", this.$onCursorChange); + this.$onSelectionChange = a.bind(this.onSelectionChange, this); + this.selection.addEventListener("changeSelection", this.$onSelectionChange); + this.onDocumentModeChange(); + this.bgTokenizer.setLines(this.doc.lines); + this.bgTokenizer.start(0); + this.onCursorChange(); + this.onSelectionChange(); + this.onDocumentChangeBreakpoint(); + this.renderer.scrollToRow(b.getScrollTopRow()); + this.renderer.updateFull() + } + }; + this.getDocument = function() { + return this.doc + }; + this.getSelection = function() { + return this.selection + }; + this.resize = function() { + this.renderer.onResize() + }; + this.setTheme = function(b) { + this.renderer.setTheme(b) + }; + this.$highlightBrackets = function() { + if(this.$bracketHighlight) { + this.renderer.removeMarker(this.$bracketHighlight); + this.$bracketHighlight = null + }if(!this.$highlightPending) { + var b = this; + this.$highlightPending = true; + setTimeout(function() { + b.$highlightPending = false; + var d = b.doc.findMatchingBracket(b.getCursorPosition()); + if(d) { + d = new g(d.row, d.column, d.row, d.column + 1); + b.$bracketHighlight = b.renderer.addMarker(d, "ace_bracket") + } + }, 10) + } + }; + this.focus = function() { + this.textInput.focus() + }; + this.blur = function() { + this.textInput.blur() + }; + this.onFocus = function() { + this.renderer.showCursor(); + this.renderer.visualizeFocus() + }; + this.onBlur = function() { + this.renderer.hideCursor(); + this.renderer.visualizeBlur() + }; + this.onDocumentChange = function(b) { + b = b.data; + this.bgTokenizer.start(b.firstRow); + this.renderer.updateLines(b.firstRow, b.lastRow); + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite) + }; + this.onTokenizerUpdate = function(b) { + b = b.data; + this.renderer.updateLines(b.first, b.last) + }; + this.onCursorChange = function() { + this.$highlightBrackets(); + this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite); + this.$blockScrolling || this.renderer.scrollCursorIntoView(); + this.$updateHighlightActiveLine() + }; + this.$updateHighlightActiveLine = function() { + this.$highlightLineMarker && this.renderer.removeMarker(this.$highlightLineMarker); + this.$highlightLineMarker = null; + if(this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { + var b = this.getCursorPosition(); + this.$highlightLineMarker = this.renderer.addMarker(new g(b.row, 0, b.row + 1, 0), "ace_active_line", "line") + } + }; + this.onSelectionChange = function() { + this.$selectionMarker && this.renderer.removeMarker(this.$selectionMarker); + this.$selectionMarker = null; + if(!this.selection.isEmpty()) { + var b = this.selection.getRange(), d = this.getSelectionStyle(); + this.$selectionMarker = this.renderer.addMarker(b, "ace_selection", d) + }this.onCursorChange() + }; + this.onDocumentChangeBreakpoint = function() { + this.renderer.setBreakpoints(this.doc.getBreakpoints()) + }; + this.onDocumentModeChange = function() { + var b = this.doc.getMode(); + if(this.mode != b) { + this.mode = b; + b = b.getTokenizer(); + if(this.bgTokenizer) { + this.bgTokenizer.setTokenizer(b) + }else { + var d = a.bind(this.onTokenizerUpdate, this); + this.bgTokenizer = new c(b, this); + this.bgTokenizer.addEventListener("update", d) + }this.renderer.setTokenizer(this.bgTokenizer) + } + }; + this.onMouseDown = function(b) { + var d = f.getDocumentX(b), n = f.getDocumentY(b); + d = this.renderer.screenToTextCoordinates(d, n); + d.row = Math.max(0, Math.min(d.row, this.doc.getLength() - 1)); + if(f.getButton(b) != 0) { + this.selection.isEmpty() && this.moveCursorToPosition(d) + }else { + if(b.shiftKey) { + this.selection.selectToPosition(d) + }else { + this.moveCursorToPosition(d); + this.$clickSelection || this.selection.clearSelection(d.row, d.column) + }this.renderer.scrollCursorIntoView(); + var o = this, p, r; + f.capture(this.container, function(s) { + p = f.getDocumentX(s); + r = f.getDocumentY(s) + }, function() { + clearInterval(q); + o.$clickSelection = null + }); + var q = setInterval(function() { + if(!(p === undefined || r === undefined)) { + var s = o.renderer.screenToTextCoordinates(p, r); + s.row = Math.max(0, Math.min(s.row, o.doc.getLength() - 1)); + if(o.$clickSelection) { + if(o.$clickSelection.contains(s.row, s.column)) { + o.selection.setSelectionRange(o.$clickSelection) + }else { + var t = o.$clickSelection.compare(s.row, s.column) == -1 ? o.$clickSelection.end : o.$clickSelection.start; + o.selection.setSelectionAnchor(t.row, t.column); + o.selection.selectToPosition(s) + } + }else { + o.selection.selectToPosition(s) + }o.renderer.scrollCursorIntoView() + } + }, 20); + return f.preventDefault(b) + } + }; + this.onMouseDoubleClick = function() { + this.selection.selectWord(); + this.$clickSelection = this.getSelectionRange(); + this.$updateDesiredColumn() + }; + this.onMouseTripleClick = function() { + this.selection.selectLine(); + this.$clickSelection = this.getSelectionRange(); + this.$updateDesiredColumn() + }; + this.onMouseWheel = function(b) { + var d = this.$scrollSpeed * 2; + this.renderer.scrollBy(b.wheelX * d, b.wheelY * d); + return f.preventDefault(b) + }; + this.getCopyText = function() { + return this.selection.isEmpty() ? "" : this.doc.getTextRange(this.getSelectionRange()) + }; + this.onCut = function() { + if(!this.$readOnly) { + if(!this.selection.isEmpty()) { + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + } + }; + this.onTextInput = function(b) { + if(!this.$readOnly) { + var d = this.getCursorPosition(); + b = b.replace("\t", this.doc.getTabString()); + if(this.selection.isEmpty()) { + if(this.$overwrite) { + var n = new g.fromPoints(d, d); + n.end.column += b.length; + this.doc.remove(n) + } + }else { + d = this.doc.remove(this.getSelectionRange()); + this.clearSelection() + }this.clearSelection(); + var o = this; + this.bgTokenizer.getState(d.row, function(p) { + var r = o.mode.checkOutdent(p, o.doc.getLine(d.row), b), q = o.doc.getLine(d.row), s = o.mode.getNextLineIndent(p, q, o.doc.getTabString()), t = o.doc.insert(d, b); + o.bgTokenizer.getState(d.row, function(x) { + if(d.row !== t.row) { + x = o.doc.getTabSize(); + for(var y = Number.MAX_VALUE, v = d.row + 1;v <= t.row;++v) { + var w = 0; + q = o.doc.getLine(v); + for(var u = 0;u < q.length;++u) { + if(q.charAt(u) == "\t") { + w += x + }else { + if(q.charAt(u) == " ") { + w += 1 + }else { + break + } + } + }if(/[^\s]$/.test(q)) { + y = Math.min(w, y) + } + }for(v = d.row + 1;v <= t.row;++v) { + w = y; + q = o.doc.getLine(v); + for(u = 0;u < q.length && w > 0;++u) { + if(q.charAt(u) == "\t") { + w -= x + }else { + if(q.charAt(u) == " ") { + w -= 1 + } + } + }o.doc.replace(new g(v, 0, v, q.length), q.substr(u)) + }t.column += o.doc.indentRows(new g(d.row + 1, 0, t.row, t.column), s) + }else { + if(r) { + t.column += o.mode.autoOutdent(x, o.doc, d.row) + } + }o.moveCursorToPosition(t); + o.renderer.scrollCursorIntoView() + }) + }) + } + }; + this.$overwrite = false; + this.setOverwrite = function(b) { + if(this.$overwrite != b) { + this.$overwrite = b; + this.$blockScrolling = true; + this.onCursorChange(); + this.$blockScrolling = false; + this.$dispatchEvent("changeOverwrite", {data:b}) + } + }; + this.getOverwrite = function() { + return this.$overwrite + }; + this.toggleOverwrite = function() { + this.setOverwrite(!this.$overwrite) + }; + this.$scrollSpeed = 1; + this.setScrollSpeed = function(b) { + this.$scrollSpeed = b + }; + this.getScrollSpeed = function() { + return this.$scrollSpeed + }; + this.$selectionStyle = "line"; + this.setSelectionStyle = function(b) { + if(this.$selectionStyle != b) { + this.$selectionStyle = b; + this.onSelectionChange(); + this.$dispatchEvent("changeSelectionStyle", {data:b}) + } + }; + this.getSelectionStyle = function() { + return this.$selectionStyle + }; + this.$highlightActiveLine = true; + this.setHighlightActiveLine = function(b) { + if(this.$highlightActiveLine != b) { + this.$highlightActiveLine = b; + this.$updateHighlightActiveLine() + } + }; + this.getHighlightActiveLine = function() { + return this.$highlightActiveLine + }; + this.setShowInvisibles = function(b) { + this.getShowInvisibles() != b && this.renderer.setShowInvisibles(b) + }; + this.getShowInvisibles = function() { + return this.renderer.getShowInvisibles() + }; + this.setShowPrintMargin = function(b) { + this.renderer.setShowPrintMargin(b) + }; + this.getShowPrintMargin = function() { + return this.renderer.getShowPrintMargin() + }; + this.setPrintMarginColumn = function(b) { + this.renderer.setPrintMarginColumn(b) + }; + this.getPrintMarginColumn = function() { + return this.renderer.getPrintMarginColumn() + }; + this.$readOnly = false; + this.setReadOnly = function(b) { + this.$readOnly = b + }; + this.getReadOnly = function() { + return this.$readOnly + }; + this.removeRight = function() { + if(!this.$readOnly) { + this.selection.isEmpty() && this.selection.selectRight(); + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + }; + this.removeLeft = function() { + if(!this.$readOnly) { + this.selection.isEmpty() && this.selection.selectLeft(); + this.moveCursorToPosition(this.doc.remove(this.getSelectionRange())); + this.clearSelection() + } + }; + this.indent = function() { + if(!this.$readOnly) { + var b = this.getSelectionRange(); + if(b.start.row < b.end.row || b.start.column < b.end.column) { + b = this.doc.indentRows(this.getSelectionRange(), "\t"); + this.selection.shiftSelection(b) + }else { + if(this.doc.getUseSoftTabs()) { + b = this.doc.getTabSize(); + b = b - this.getCursorPosition().column % b; + b = a.stringRepeat(" ", b) + }else { + b = "\t" + }return this.onTextInput(b) + } + } + }; + this.blockOutdent = function() { + if(!this.$readOnly) { + var b = this.doc.getSelection(), d = this.doc.outdentRows(b.getRange()); + b.setSelectionRange(d, b.isBackwards()); + this.$updateDesiredColumn() + } + }; + this.toggleCommentLines = function() { + if(!this.$readOnly) { + var b = this.$getSelectedRows(), d = new g(b.first, 0, b.last, 0), n = this; + this.bgTokenizer.getState(this.getCursorPosition().row, function(o) { + o = n.mode.toggleCommentLines(o, n.doc, d); + n.selection.shiftSelection(o) + }) + } + }; + this.removeLines = function() { + if(!this.$readOnly) { + var b = this.$getSelectedRows(); + this.selection.setSelectionAnchor(b.last + 1, 0); + this.selection.selectTo(b.first, 0); + this.doc.remove(this.getSelectionRange()); + this.clearSelection() + } + }; + this.moveLinesDown = function() { + this.$readOnly || this.$moveLines(function(b, d) { + return this.doc.moveLinesDown(b, d) + }) + }; + this.moveLinesUp = function() { + this.$readOnly || this.$moveLines(function(b, d) { + return this.doc.moveLinesUp(b, d) + }) + }; + this.copyLinesUp = function() { + this.$readOnly || this.$moveLines(function(b, d) { + this.doc.duplicateLines(b, d); + return 0 + }) + }; + this.copyLinesDown = function() { + this.$readOnly || this.$moveLines(function(b, d) { + return this.doc.duplicateLines(b, d) + }) + }; + this.$moveLines = function(b) { + var d = this.$getSelectedRows(), n = b.call(this, d.first, d.last), o = this.selection; + o.setSelectionAnchor(d.last + n + 1, 0); + o.$moveSelection(function() { + o.moveCursorTo(d.first + n, 0) + }) + }; + this.$getSelectedRows = function() { + var b = this.getSelectionRange(), d = b.start.row, n = b.end.row; + if(b.end.column == 0 && b.start.row !== b.end.row) { + n -= 1 + }return{first:d, last:n} + }; + this.onCompositionStart = function() { + this.renderer.showComposition(this.getCursorPosition()) + }; + this.onCompositionUpdate = function(b) { + this.renderer.setCompositionText(b) + }; + this.onCompositionEnd = function() { + this.renderer.hideComposition() + }; + this.getFirstVisibleRow = function() { + return this.renderer.getFirstVisibleRow() + }; + this.getLastVisibleRow = function() { + return this.renderer.getLastVisibleRow() + }; + this.isRowVisible = function(b) { + return b >= this.getFirstVisibleRow() && b <= this.getLastVisibleRow() + }; + this.getVisibleRowCount = function() { + return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1 + }; + this.getPageDownRow = function() { + return this.renderer.getLastVisibleRow() - 1 + }; + this.getPageUpRow = function() { + var b = this.renderer.getFirstVisibleRow(), d = this.renderer.getLastVisibleRow(); + return b - (d - b) + 1 + }; + this.selectPageDown = function() { + var b = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2); + this.scrollPageDown(); + var d = this.getSelection(); + d.$moveSelection(function() { + d.moveCursorTo(b, d.getSelectionLead().column) + }) + }; + this.selectPageUp = function() { + var b = this.getLastVisibleRow() - this.getFirstVisibleRow(), d = this.getPageUpRow() + Math.round(b / 2); + this.scrollPageUp(); + var n = this.getSelection(); + n.$moveSelection(function() { + n.moveCursorTo(d, n.getSelectionLead().column) + }) + }; + this.gotoPageDown = function() { + var b = this.getPageDownRow(), d = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); + this.scrollToRow(b); + this.getSelection().moveCursorTo(b, d) + }; + this.gotoPageUp = function() { + var b = this.getPageUpRow(), d = Math.min(this.getCursorPosition().column, this.doc.getLine(b).length); + this.scrollToRow(b); + this.getSelection().moveCursorTo(b, d) + }; + this.scrollPageDown = function() { + this.scrollToRow(this.getPageDownRow()) + }; + this.scrollPageUp = function() { + this.renderer.scrollToRow(this.getPageUpRow()) + }; + this.scrollToRow = function(b) { + this.renderer.scrollToRow(b) + }; + this.getCursorPosition = function() { + return this.selection.getCursor() + }; + this.getSelectionRange = function() { + return this.selection.getRange() + }; + this.clearSelection = function() { + this.selection.clearSelection(); + this.$updateDesiredColumn() + }; + this.moveCursorTo = function(b, d) { + this.selection.moveCursorTo(b, d); + this.$updateDesiredColumn() + }; + this.moveCursorToPosition = function(b) { + this.selection.moveCursorToPosition(b); + this.$updateDesiredColumn() + }; + this.gotoLine = function(b, d) { + this.selection.clearSelection(); + this.$blockScrolling = true; + this.moveCursorTo(b - 1, d || 0); + this.$blockScrolling = false; + this.isRowVisible(this.getCursorPosition().row) || this.scrollToRow(b - 1 - Math.floor(this.getVisibleRowCount() / 2)) + }; + this.navigateTo = function(b, d) { + this.clearSelection(); + this.moveCursorTo(b, d); + this.$updateDesiredColumn(d) + }; + this.navigateUp = function() { + this.selection.clearSelection(); + this.selection.moveCursorBy(-1, 0); + if(this.$desiredColumn) { + var b = this.getCursorPosition(), d = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); + this.selection.moveCursorTo(b.row, d) + } + }; + this.navigateDown = function() { + this.selection.clearSelection(); + this.selection.moveCursorBy(1, 0); + if(this.$desiredColumn) { + var b = this.getCursorPosition(), d = this.doc.screenToDocumentColumn(b.row, this.$desiredColumn); + this.selection.moveCursorTo(b.row, d) + } + }; + this.$updateDesiredColumn = function() { + var b = this.getCursorPosition(); + this.$desiredColumn = this.doc.documentToScreenColumn(b.row, b.column) + }; + this.navigateLeft = function() { + this.selection.isEmpty() ? this.selection.moveCursorLeft() : this.moveCursorToPosition(this.getSelectionRange().start); + this.clearSelection() + }; + this.navigateRight = function() { + this.selection.isEmpty() ? this.selection.moveCursorRight() : this.moveCursorToPosition(this.getSelectionRange().end); + this.clearSelection() + }; + this.navigateLineStart = function() { + this.selection.moveCursorLineStart(); + this.clearSelection() + }; + this.navigateLineEnd = function() { + this.selection.moveCursorLineEnd(); + this.clearSelection() + }; + this.navigateFileEnd = function() { + this.selection.moveCursorFileEnd(); + this.clearSelection() + }; + this.navigateFileStart = function() { + this.selection.moveCursorFileStart(); + this.clearSelection() + }; + this.navigateWordRight = function() { + this.selection.moveCursorWordRight(); + this.clearSelection() + }; + this.navigateWordLeft = function() { + this.selection.moveCursorWordLeft(); + this.clearSelection() + }; + this.replace = function(b, d) { + d && this.$search.set(d); + d = this.$search.find(this.doc); + this.$tryReplace(d, b); + d !== null && this.selection.setSelectionRange(d); + this.$updateDesiredColumn() + }; + this.replaceAll = function(b, d) { + d && this.$search.set(d); + this.clearSelection(); + this.selection.moveCursorTo(0, 0); + d = this.$search.findAll(this.doc); + if(d.length) { + for(var n = d.length - 1;n >= 0;--n) { + this.$tryReplace(d[n], b) + }d[0] !== null && this.selection.setSelectionRange(d[0]); + this.$updateDesiredColumn() + } + }; + this.$tryReplace = function(b, d) { + d = this.$search.replace(this.doc.getTextRange(b), d); + if(d !== null) { + b.end = this.doc.replace(b, d); + return b + }else { + return null + } + }; + this.getLastSearchOptions = function() { + return this.$search.getOptions() + }; + this.find = function(b, d) { + this.clearSelection(); + d = d || {}; + d.needle = b; + this.$search.set(d); + this.$find() + }; + this.findNext = function(b) { + b = b || {}; + if(typeof b.backwards == "undefined") { + b.backwards = false + }this.$search.set(b); + this.$find() + }; + this.findPrevious = function(b) { + b = b || {}; + if(typeof b.backwards == "undefined") { + b.backwards = true + }this.$search.set(b); + this.$find() + }; + this.$find = function(b) { + this.selection.isEmpty() || this.$search.set({needle:this.doc.getTextRange(this.getSelectionRange())}); + typeof b != "undefined" && this.$search.set({backwards:b}); + if(b = this.$search.find(this.doc)) { + this.gotoLine(b.end.row + 1, b.end.column); + this.$updateDesiredColumn(); + this.selection.setSelectionRange(b) + } + }; + this.undo = function() { + this.doc.getUndoManager().undo() + }; + this.redo = function() { + this.doc.getUndoManager().redo() + } + }).call(m.prototype); + return m +}); +require.def("ace/UndoManager", function() { + var k = function() { + this.$undoStack = []; + this.$redoStack = [] + }; + (function() { + this.execute = function(f) { + var a = f.args[0]; + this.$doc = f.args[1]; + this.$undoStack.push(a) + }; + this.undo = function() { + var f = this.$undoStack.pop(); + if(f) { + this.$doc.undoChanges(f); + this.$redoStack.push(f) + } + }; + this.redo = function() { + var f = this.$redoStack.pop(); + if(f) { + this.$doc.redoChanges(f); + this.$undoStack.push(f) + } + } + }).call(k.prototype); + return k +}); +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/dom", ["ace/lib/lang"], function(k) { + var f = {}; + f.setText = function(a, h) { + if(a.innerText !== undefined) { + a.innerText = h + }if(a.textContent !== undefined) { + a.textContent = h + } + }; + f.hasCssClass = function(a, h) { + a = a.className.split(/\s+/g); + return k.arrayIndexOf(a, h) !== -1 + }; + f.addCssClass = function(a, h) { + f.hasCssClass(a, h) || (a.className += " " + h) + }; + f.removeCssClass = function(a, h) { + for(var i = a.className.split(/\s+/g);;) { + var e = k.arrayIndexOf(i, h); + if(e == -1) { + break + }i.splice(e, 1) + }a.className = i.join(" ") + }; + f.importCssString = function(a, h) { + h = h || document; + if(h.createStyleSheet) { + h.createStyleSheet().cssText = a + }else { + var i = h.createElement("style"); + i.appendChild(h.createTextNode(a)); + h.getElementsByTagName("head")[0].appendChild(i) + } + }; + f.getInnerWidth = function(a) { + return parseInt(f.computedStyle(a, "paddingLeft")) + parseInt(f.computedStyle(a, "paddingRight")) + a.clientWidth + }; + f.getInnerHeight = function(a) { + return parseInt(f.computedStyle(a, "paddingTop")) + parseInt(f.computedStyle(a, "paddingBottom")) + a.clientHeight + }; + f.computedStyle = function(a, h) { + return window.getComputedStyle ? (window.getComputedStyle(a, "") || {})[h] || "" : a.currentStyle[h] + }; + f.scrollbarWidth = function() { + var a = document.createElement("p"); + a.style.width = "100%"; + a.style.height = "200px"; + var h = document.createElement("div"), i = h.style; + i.position = "absolute"; + i.left = "-10000px"; + i.overflow = "hidden"; + i.width = "200px"; + i.height = "150px"; + h.appendChild(a); + document.body.appendChild(h); + var e = a.offsetWidth; + i.overflow = "scroll"; + a = a.offsetWidth; + if(e == a) { + a = h.clientWidth + }document.body.removeChild(h); + return e - a + }; + return f +}); +require.def("ace/layer/Gutter", [], function() { + var k = function(f) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + f.appendChild(this.element); + this.$breakpoints = []; + this.$decorations = [] + }; + (function() { + this.addGutterDecoration = function(f, a) { + this.$decorations[f] || (this.$decorations[f] = ""); + this.$decorations[f] += " ace_" + a + }; + this.removeGutterDecoration = function(f, a) { + this.$decorations[f] = this.$decorations[f].replace(" ace_" + a, "") + }; + this.setBreakpoints = function(f) { + this.$breakpoints = f.concat() + }; + this.update = function(f) { + this.$config = f; + for(var a = [], h = f.firstRow;h <= f.lastRow;h++) { + a.push("", h + 1, ""); + a.push("") + }this.element.innerHTML = a.join(""); + this.element.style.height = f.minHeight + "px" + } + }).call(k.prototype); + return k +}); +require.def("ace/layer/Marker", ["ace/Range"], function(k) { + var f = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + a.appendChild(this.element); + this.markers = {}; + this.$markerId = 1 + }; + (function() { + this.setDocument = function(a) { + this.doc = a + }; + this.addMarker = function(a, h, i) { + var e = this.$markerId++; + this.markers[e] = {range:a, type:i || "line", clazz:h}; + return e + }; + this.removeMarker = function(a) { + this.markers[a] && delete this.markers[a] + }; + this.update = function(a) { + if(a = a || this.config) { + this.config = a; + var h = []; + for(var i in this.markers) { + var e = this.markers[i], j = e.range.clipRows(a.firstRow, a.lastRow); + if(!j.isEmpty()) { + if(j.isMultiLine()) { + e.type == "text" ? this.drawTextMarker(h, j, e.clazz, a) : this.drawMultiLineMarker(h, j, e.clazz, a) + }else { + this.drawSingleLineMarker(h, j, e.clazz, a) + } + } + }this.element.innerHTML = h.join("") + } + }; + this.drawTextMarker = function(a, h, i, e) { + var j = h.start.row, c = new k(j, h.start.column, j, this.doc.getLine(j).length); + this.drawSingleLineMarker(a, c, i, e); + j = h.end.row; + c = new k(j, 0, j, h.end.column); + this.drawSingleLineMarker(a, c, i, e); + for(j = h.start.row + 1;j < h.end.row;j++) { + c.start.row = j; + c.end.row = j; + c.end.column = this.doc.getLine(j).length; + this.drawSingleLineMarker(a, c, i, e) + } + }; + this.drawMultiLineMarker = function(a, h, i, e) { + h = h.toScreenRange(this.doc); + var j = e.lineHeight, c = Math.round(e.width - h.start.column * e.characterWidth), g = (h.start.row - e.firstRow) * e.lineHeight, l = Math.round(h.start.column * e.characterWidth); + a.push(""); + g = (h.end.row - e.firstRow) * e.lineHeight; + c = Math.round(h.end.column * e.characterWidth); + a.push(""); + j = (h.end.row - h.start.row - 1) * e.lineHeight; + if(!(j < 0)) { + g = (h.start.row + 1 - e.firstRow) * e.lineHeight; + a.push("") + } + }; + this.drawSingleLineMarker = function(a, h, i, e) { + h = h.toScreenRange(this.doc); + var j = e.lineHeight, c = Math.round((h.end.column - h.start.column) * e.characterWidth), g = (h.start.row - e.firstRow) * e.lineHeight; + h = Math.round(h.start.column * e.characterWidth); + a.push("") + } + }).call(f.prototype); + return f +}); +require.def("ace/layer/Text", ["ace/lib/oop", "ace/lib/dom", "ace/MEventEmitter"], function(k, f, a) { + var h = function(i) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + i.appendChild(this.element); + this.$characterSize = this.$measureSizes(); + this.$pollSizeChanges() + }; + (function() { + k.implement(this, a); + this.EOF_CHAR = "¶"; + this.EOL_CHAR = "¬"; + this.TAB_CHAR = "→"; + this.SPACE_CHAR = "·"; + this.setTokenizer = function(i) { + this.tokenizer = i + }; + this.getLineHeight = function() { + return this.$characterSize.height || 1 + }; + this.getCharacterWidth = function() { + return this.$characterSize.width || 1 + }; + this.$pollSizeChanges = function() { + var i = this; + setInterval(function() { + var e = i.$measureSizes(); + if(i.$characterSize.width !== e.width || i.$characterSize.height !== e.height) { + i.$characterSize = e; + i.$dispatchEvent("changeCharaterSize", {data:e}) + } + }, 500) + }; + this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1}; + this.$measureSizes = function() { + var i = document.createElement("div"), e = i.style; + e.width = e.height = "auto"; + e.left = e.top = "-1000px"; + e.visibility = "hidden"; + e.position = "absolute"; + e.overflow = "visible"; + for(var j in this.$fontStyles) { + var c = f.computedStyle(this.element, j); + e[j] = c + }i.innerHTML = (new Array(1E3)).join("Xy"); + document.body.insertBefore(i, document.body.firstChild); + e = {height:i.offsetHeight, width:i.offsetWidth / 2E3}; + document.body.removeChild(i); + return e + }; + this.setDocument = function(i) { + this.doc = i + }; + this.$showInvisibles = false; + this.setShowInvisibles = function(i) { + this.$showInvisibles = i + }; + this.$computeTabString = function() { + var i = this.doc.getTabSize(); + if(this.$showInvisibles) { + i = i / 2; + this.$tabString = "" + (new Array(Math.floor(i))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(i) + 1)).join(" ") + "" + }else { + this.$tabString = (new Array(i + 1)).join(" ") + } + }; + this.updateLines = function(i, e, j) { + this.$computeTabString(); + var c = Math.max(e, i.firstRow), g = Math.min(j, i.lastRow), l = this.element.childNodes, m = this; + this.tokenizer.getTokens(c, g, function(b) { + for(var d = c;d <= g;d++) { + var n = l[d - i.firstRow]; + if(n) { + var o = []; + m.$renderLine(o, d, b[d - c].tokens); + n.innerHTML = o.join("") + } + } + }) + }; + this.scrollLines = function(i) { + function e(b) { + i.firstRow < g.firstRow ? c.$renderLinesFragment(i, i.firstRow, g.firstRow - 1, function(d) { + l.firstChild ? l.insertBefore(d, l.firstChild) : l.appendChild(d); + b() + }) : b() + } + function j() { + i.lastRow > g.lastRow && c.$renderLinesFragment(i, g.lastRow + 1, i.lastRow, function(b) { + l.appendChild(b) + }) + } + var c = this; + this.$computeTabString(); + var g = this.config; + this.config = i; + if(!g || g.lastRow < i.firstRow) { + return this.update(i) + }if(i.lastRow < g.firstRow) { + return this.update(i) + }var l = this.element; + if(g.firstRow < i.firstRow) { + for(var m = g.firstRow;m < i.firstRow;m++) { + l.removeChild(l.firstChild) + } + }if(g.lastRow > i.lastRow) { + for(m = i.lastRow + 1;m <= g.lastRow;m++) { + l.removeChild(l.lastChild) + } + }e(j) + }; + this.$renderLinesFragment = function(i, e, j, c) { + var g = document.createDocumentFragment(), l = this; + this.tokenizer.getTokens(e, j, function(m) { + for(var b = e;b <= j;b++) { + var d = document.createElement("div"); + d.className = "ace_line"; + var n = d.style; + n.height = l.$characterSize.height + "px"; + n.width = i.width + "px"; + n = []; + l.$renderLine(n, b, m[b - e].tokens); + d.innerHTML = n.join(""); + g.appendChild(d) + }c(g) + }) + }; + this.update = function(i) { + this.$computeTabString(); + var e = [], j = this; + this.tokenizer.getTokens(i.firstRow, i.lastRow, function(c) { + for(var g = i.firstRow;g <= i.lastRow;g++) { + e.push(""); + j.$renderLine(e, g, c[g - i.firstRow].tokens); + e.push("") + }j.element.innerHTML = e.join("") + }) + }; + this.$textToken = {text:true, rparen:true, lparen:true}; + this.$renderLine = function(i, e, j) { + for(var c = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, g = 0;g < j.length;g++) { + var l = j[g], m = l.value.replace(/&/g, "&").replace(/", m, "") + } + }if(this.$showInvisibles) { + e !== this.doc.getLength() - 1 ? i.push("" + this.EOL_CHAR + "") : i.push("" + this.EOF_CHAR + "") + } + } + }).call(h.prototype); + return h +}); +require.def("ace/layer/Cursor", ["ace/lib/dom"], function(k) { + var f = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + a.appendChild(this.element); + this.cursor = document.createElement("div"); + this.cursor.className = "ace_cursor"; + this.isVisible = false + }; + (function() { + this.setDocument = function(a) { + this.doc = a + }; + this.setCursor = function(a, h) { + this.position = {row:a.row, column:this.doc.documentToScreenColumn(a.row, a.column)}; + h ? k.addCssClass(this.cursor, "ace_overwrite") : k.removeCssClass(this.cursor, "ace_overwrite") + }; + this.hideCursor = function() { + this.isVisible = false; + this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor); + clearInterval(this.blinkId) + }; + this.showCursor = function() { + this.isVisible = true; + this.element.appendChild(this.cursor); + this.cursor.style.visibility = "visible"; + this.restartTimer() + }; + this.restartTimer = function() { + clearInterval(this.blinkId); + if(this.isVisible) { + var a = this.cursor; + this.blinkId = setInterval(function() { + a.style.visibility = "hidden"; + setTimeout(function() { + a.style.visibility = "visible" + }, 400) + }, 1E3) + } + }; + this.getPixelPosition = function() { + if(!this.config || !this.position) { + return{left:0, top:0} + }var a = this.position.row * this.config.lineHeight; + return{left:Math.round(this.position.column * this.config.characterWidth), top:a} + }; + this.update = function(a) { + if(this.position) { + this.config = a; + var h = Math.round(this.position.column * a.characterWidth), i = this.position.row * a.lineHeight; + this.pixelPos = {left:h, top:i}; + this.cursor.style.left = h + "px"; + this.cursor.style.top = i - a.firstRow * a.lineHeight + "px"; + this.cursor.style.width = a.characterWidth + "px"; + this.cursor.style.height = a.lineHeight + "px"; + this.isVisible && this.element.appendChild(this.cursor); + this.restartTimer() + } + } + }).call(f.prototype); + return f +}); +require.def("ace/ScrollBar", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/MEventEmitter"], function(k, f, a, h, i) { + var e = function(j) { + this.element = document.createElement("div"); + this.element.className = "ace_sb"; + this.inner = document.createElement("div"); + this.element.appendChild(this.inner); + j.appendChild(this.element); + this.width = a.scrollbarWidth(); + this.element.style.width = this.width; + h.addListener(this.element, "scroll", f.bind(this.onScroll, this)) + }; + (function() { + k.implement(this, i); + this.onScroll = function() { + this.$dispatchEvent("scroll", {data:this.element.scrollTop}) + }; + this.getWidth = function() { + return this.width + }; + this.setHeight = function(j) { + this.element.style.height = Math.max(0, j - this.width) + "px" + }; + this.setInnerHeight = function(j) { + this.inner.style.height = j + "px" + }; + this.setScrollTop = function(j) { + this.element.scrollTop = j + } + }).call(e.prototype); + return e +}); +require.def("ace/RenderLoop", function() { + var k = function(f) { + this.onRender = f; + this.pending = false; + this.changes = 0 + }; + (function() { + this.schedule = function(f) { + this.changes |= f; + if(!this.pending) { + this.pending = true; + var a = this; + this.setTimeoutZero(function() { + a.pending = false; + a.onRender(a.changes); + a.changes = 0 + }) + } + }; + if(window.postMessage) { + this.messageName = "zero-timeout-message"; + this.setTimeoutZero = function(f) { + if(!this.attached) { + var a = this; + window.addEventListener("message", function(h) { + if(h.source == window && a.callback && h.data == a.messageName) { + h.stopPropagation(); + a.callback() + } + }, false); + this.attached = true + }this.callback = f; + window.postMessage(this.messageName, "*") + } + }else { + this.setTimeoutZero = function(f) { + setTimeout(f, 0) + } + } + }).call(k.prototype); + return k +}); +require.def("ace/VirtualRenderer", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/layer/Gutter", "ace/layer/Marker", "ace/layer/Text", "ace/layer/Cursor", "ace/ScrollBar", "ace/RenderLoop", "ace/MEventEmitter", 'text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}'], +function(k, f, a, h, i, e, j, c, g, l, m, b) { + a.importCssString(b); + b = function(d, n) { + this.container = d; + a.addCssClass(this.container, "ace_editor"); + this.setTheme(n); + this.scroller = document.createElement("div"); + this.scroller.className = "ace_scroller"; + this.container.appendChild(this.scroller); + this.$gutter = document.createElement("div"); + this.$gutter.className = "ace_gutter"; + this.container.appendChild(this.$gutter); + this.content = document.createElement("div"); + this.content.style.position = "absolute"; + this.scroller.appendChild(this.content); + this.$gutterLayer = new i(this.$gutter); + this.$markerLayer = new e(this.content); + var o = this.$textLayer = new j(this.content); + this.canvas = o.element; + this.characterWidth = o.getCharacterWidth(); + this.lineHeight = o.getLineHeight(); + this.$cursorLayer = new c(this.content); + this.layers = [this.$markerLayer, o, this.$cursorLayer]; + this.scrollBar = new g(d); + this.scrollBar.addEventListener("scroll", f.bind(this.onScroll, this)); + this.scrollTop = 0; + this.cursorPos = {row:0, column:0}; + var p = this; + this.$textLayer.addEventListener("changeCharaterSize", function() { + p.characterWidth = o.getCharacterWidth(); + p.lineHeight = o.getLineHeight(); + p.$loop.schedule(p.CHANGE_FULL) + }); + h.addListener(this.$gutter, "click", f.bind(this.$onGutterClick, this)); + h.addListener(this.$gutter, "dblclick", f.bind(this.$onGutterClick, this)); + this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0}; + this.$loop = new l(f.bind(this.$renderChanges, this)); + this.$loop.schedule(this.CHANGE_FULL); + this.$updatePrintMargin(); + this.setPadding(4) + }; + (function() { + this.showGutter = true; + this.CHANGE_CURSOR = 1; + this.CHANGE_MARKER = 2; + this.CHANGE_GUTTER = 4; + this.CHANGE_SCROLL = 8; + this.CHANGE_LINES = 16; + this.CHANGE_TEXT = 32; + this.CHANGE_SIZE = 64; + this.CHANGE_FULL = 128; + k.implement(this, m); + this.setDocument = function(d) { + this.lines = d.lines; + this.doc = d; + this.$cursorLayer.setDocument(d); + this.$markerLayer.setDocument(d); + this.$textLayer.setDocument(d); + this.$loop.schedule(this.CHANGE_FULL) + }; + this.updateLines = function(d, n) { + if(n === undefined) { + n = Infinity + }if(this.$changedLines) { + if(this.$changedLines.firstRow > d) { + this.$changedLines.firstRow = d + }if(this.$changedLines.lastRow < n) { + this.$changedLines.lastRow = n + } + }else { + this.$changedLines = {firstRow:d, lastRow:n} + }this.$loop.schedule(this.CHANGE_LINES) + }; + this.updateText = function() { + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.updateFull = function() { + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onResize = function() { + this.$loop.schedule(this.CHANGE_SIZE); + var d = a.getInnerHeight(this.container); + if(this.$size.height != d) { + this.$size.height = d; + this.scroller.style.height = d + "px"; + this.scrollBar.setHeight(d); + if(this.doc) { + this.scrollToY(this.getScrollTop()); + this.$loop.schedule(this.CHANGE_FULL) + } + }d = a.getInnerWidth(this.container); + if(this.$size.width != d) { + this.$size.width = d; + var n = this.showGutter ? this.$gutter.offsetWidth : 0; + this.scroller.style.left = n + "px"; + this.scroller.style.width = Math.max(0, d - n - this.scrollBar.getWidth()) + "px" + }this.$size.scrollerWidth = this.scroller.clientWidth; + this.$size.scrollerHeight = this.scroller.clientHeight + }; + this.setTokenizer = function(d) { + this.$tokenizer = d; + this.$textLayer.setTokenizer(d); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.$onGutterClick = function(d) { + var n = h.getDocumentX(d), o = h.getDocumentY(d); + this.$dispatchEvent("gutter" + d.type, {row:this.screenToTextCoordinates(n, o).row, htmlEvent:d}) + }; + this.$showInvisibles = true; + this.setShowInvisibles = function(d) { + this.$showInvisibles = d; + this.$textLayer.setShowInvisibles(d); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.getShowInvisibles = function() { + return this.$showInvisibles + }; + this.$showPrintMargin = true; + this.setShowPrintMargin = function(d) { + this.$showPrintMargin = d; + this.$updatePrintMargin() + }; + this.getShowPrintMargin = function() { + return this.$showPrintMargin + }; + this.$printMarginColumn = 80; + this.setPrintMarginColumn = function(d) { + this.$printMarginColumn = d; + this.$updatePrintMargin() + }; + this.getPrintMarginColumn = function() { + return this.$printMarginColumn + }; + this.setShowGutter = function(d) { + this.$gutter.style.display = d ? "block" : "none"; + this.showGutter = d; + this.onResize() + }; + this.$updatePrintMargin = function() { + if(this.$showPrintMargin || this.$printMarginEl) { + if(!this.$printMarginEl) { + this.$printMarginEl = document.createElement("div"); + this.$printMarginEl.className = "ace_printMargin"; + this.content.insertBefore(this.$printMarginEl, this.$textLayer.element) + }var d = this.$printMarginEl.style; + d.left = this.characterWidth * this.$printMarginColumn + "px"; + d.visibility = this.$showPrintMargin ? "visible" : "hidden" + } + }; + this.getContainerElement = function() { + return this.container + }; + this.getMouseEventTarget = function() { + return this.content + }; + this.getFirstVisibleRow = function() { + return(this.layerConfig || {}).firstRow || 0 + }; + this.getFirstFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1) + }; + this.getLastFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow - 1 + Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight) + }; + this.getLastVisibleRow = function() { + return(this.layerConfig || {}).lastRow || 0 + }; + this.$padding = null; + this.setPadding = function(d) { + this.$padding = d; + this.content.style.padding = "0 " + d + "px"; + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onScroll = function(d) { + this.scrollToY(d.data) + }; + this.$updateScrollBar = function() { + this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight); + this.scrollBar.setScrollTop(this.scrollTop) + }; + this.$renderChanges = function(d) { + if(!(!d || !this.doc || !this.$tokenizer)) { + if(!this.layerConfig || d & this.CHANGE_FULL || d & this.CHANGE_SIZE || d & this.CHANGE_TEXT || d & this.CHANGE_LINES || d & this.CHANGE_SCROLL) { + this.$computeLayerConfig() + }if(d & this.CHANGE_FULL) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(d & this.CHANGE_SCROLL) { + d & this.CHANGE_TEXT || d & this.CHANGE_LINES ? this.$textLayer.scrollLines(this.layerConfig) : this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(d & this.CHANGE_TEXT) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + }else { + if(d & this.CHANGE_LINES) { + this.$updateLines(); + this.$updateScrollBar() + }else { + if(d & this.CHANGE_SCROLL) { + this.$textLayer.scrollLines(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + } + } + }d & this.CHANGE_GUTTER && this.showGutter && this.$gutterLayer.update(this.layerConfig); + d & this.CHANGE_CURSOR && this.$cursorLayer.update(this.layerConfig); + d & this.CHANGE_MARKER && this.$markerLayer.update(this.layerConfig); + d & this.CHANGE_SIZE && this.$updateScrollBar() + } + } + } + }; + this.$computeLayerConfig = function() { + var d = this.scrollTop % this.lineHeight, n = this.$size.scrollerHeight + this.lineHeight, o = this.$getLongestLine(), p = !this.layerConfig ? true : this.layerConfig.width != o, r = Math.ceil(n / this.lineHeight), q = Math.max(0, Math.round((this.scrollTop - d) / this.lineHeight)); + r = Math.min(this.lines.length, q + r) - 1; + this.layerConfig = {width:o, padding:this.$padding, firstRow:q, lastRow:r, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:n, offset:d, height:this.$size.scrollerHeight}; + for(q = 0;q < this.layers.length;q++) { + r = this.layers[q]; + if(p) { + r.element.style.width = o + "px" + } + }this.$gutterLayer.element.style.marginTop = -d + "px"; + this.content.style.marginTop = -d + "px"; + this.content.style.width = o + "px"; + this.content.style.height = n + "px" + }; + this.$updateLines = function() { + var d = this.$changedLines.firstRow, n = this.$changedLines.lastRow; + this.$changedLines = null; + var o = this.layerConfig; + if(o.width != this.$getLongestLine()) { + return this.$textLayer.update(o) + }if(!(d > o.lastRow + 1)) { + if(!(n < o.firstRow)) { + if(n === Infinity) { + this.showGutter && this.$gutterLayer.update(o); + this.$textLayer.update(o) + }else { + this.$textLayer.updateLines(o, d, n) + } + } + } + }; + this.$getLongestLine = function() { + var d = this.doc.getScreenWidth(); + if(this.$showInvisibles) { + d += 1 + }return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(d * this.characterWidth)) + }; + this.addMarker = function(d, n, o) { + d = this.$markerLayer.addMarker(d, n, o); + this.$loop.schedule(this.CHANGE_MARKER); + return d + }; + this.removeMarker = function(d) { + this.$markerLayer.removeMarker(d); + this.$loop.schedule(this.CHANGE_MARKER) + }; + this.addGutterDecoration = function(d, n) { + this.$gutterLayer.addGutterDecoration(d, n); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.removeGutterDecoration = function(d, n) { + this.$gutterLayer.removeGutterDecoration(d, n); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.setBreakpoints = function(d) { + this.$gutterLayer.setBreakpoints(d); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.updateCursor = function(d, n) { + this.$cursorLayer.setCursor(d, n); + this.$loop.schedule(this.CHANGE_CURSOR) + }; + this.hideCursor = function() { + this.$cursorLayer.hideCursor() + }; + this.showCursor = function() { + this.$cursorLayer.showCursor() + }; + this.scrollCursorIntoView = function() { + var d = this.$cursorLayer.getPixelPosition(), n = d.left + this.$padding; + d = d.top; + this.getScrollTop() > d && this.scrollToY(d); + this.getScrollTop() + this.$size.scrollerHeight < d + this.lineHeight && this.scrollToY(d + this.lineHeight - this.$size.scrollerHeight); + this.scroller.scrollLeft > n && this.scrollToX(n); + this.scroller.scrollLeft + this.$size.scrollerWidth < n + this.characterWidth && this.scrollToX(Math.round(n + this.characterWidth - this.$size.scrollerWidth)) + }; + this.getScrollTop = function() { + return this.scrollTop + }; + this.getScrollLeft = function() { + return this.scroller.scrollLeft + }; + this.getScrollTopRow = function() { + return this.scrollTop / this.lineHeight + }; + this.scrollToRow = function(d) { + this.scrollToY(d * this.lineHeight) + }; + this.scrollToY = function(d) { + d = Math.max(0, Math.min(this.lines.length * this.lineHeight - this.$size.scrollerHeight, d)); + if(this.scrollTop !== d) { + this.scrollTop = d; + this.$loop.schedule(this.CHANGE_SCROLL) + } + }; + this.scrollToX = function(d) { + if(d <= this.$padding) { + d = 0 + }this.scroller.scrollLeft = d + }; + this.scrollBy = function(d, n) { + n && this.scrollToY(this.scrollTop + n); + d && this.scrollToX(this.scroller.scrollLeft + d) + }; + this.screenToTextCoordinates = function(d, n) { + var o = this.scroller.getBoundingClientRect(); + d = Math.round((d + this.scroller.scrollLeft - o.left - this.$padding) / this.characterWidth); + n = Math.floor((n + this.scrollTop - o.top) / this.lineHeight); + return{row:n, column:this.doc.screenToDocumentColumn(Math.max(0, Math.min(n, this.doc.getLength() - 1)), d)} + }; + this.textToScreenCoordinates = function(d, n) { + var o = this.scroller.getBoundingClientRect(); + n = this.padding + Math.round(this.doc.documentToScreenColumn(d, n) * this.characterWidth); + d = d * this.lineHeight; + return{pageX:o.left + n - this.getScrollLeft(), pageY:o.top + d - this.getScrollTop()} + }; + this.visualizeFocus = function() { + a.addCssClass(this.container, "ace_focus") + }; + this.visualizeBlur = function() { + a.removeCssClass(this.container, "ace_focus") + }; + this.showComposition = function() { + }; + this.setCompositionText = function() { + }; + this.hideComposition = function() { + }; + this.setTheme = function(d) { + function n(p) { + o.$theme && a.removeCssClass(o.container, o.$theme); + o.$theme = p ? p.cssClass : null; + o.$theme && a.addCssClass(o.container, o.$theme); + if(o.$size) { + o.$size.width = 0; + o.onResize() + } + } + var o = this; + if(!d || typeof d == "string") { + d = d || "ace/theme/TextMate"; + require([d], function(p) { + n(p) + }) + }else { + n(d) + }o = this + } + }).call(b.prototype); + return b +}); +require.def("ace/mode/DocCommentHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(k, f) { + var a = function() { + this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]} + }; + k.inherits(a, f); + (function() { + this.getStartRule = function(h) { + return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:h} + } + }).call(a.prototype); + return a +}); +require.def("ace/mode/JavaScriptHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/DocCommentHighlightRules", "ace/mode/TextHighlightRules"], function(k, f, a, h) { + JavaScriptHighlightRules = function() { + var i = new a, e = f.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), j = f.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), c = f.arrayToMap("abstract|boolean|byte|char|class|const|enum|export|extends|final|float|goto|implements|int|interface|long|native|package|private|protected|short|static|super|synchronized|throws|transient|volatiledouble|import|public".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, i.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric", + regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:function(g) { + return g == "this" ? "variable.language" : e[g] ? "keyword" : j[g] ? "constant.language" : c[g] ? "invalid.illegal" : g == "debugger" ? "invalid.deprecated" : "identifier" + }, regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"}, {token:"keyword.operator", regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(in|instanceof|new|delete|typeof|void)"}, {token:"lparen", regex:"[\\[\\(\\{]"}, {token:"rparen", regex:"[\\]\\)\\}]"}, {token:"text", regex:"\\s+"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]}; + this.addRules(i.getRules(), "doc-"); + this.$rules["doc-start"][0].next = "start" + }; + k.inherits(JavaScriptHighlightRules, h); + return JavaScriptHighlightRules +}); +require.def("ace/mode/MatchingBraceOutdent", ["ace/Range"], function(k) { + var f = function() { + }; + (function() { + this.checkOutdent = function(a, h) { + if(!/^\s+$/.test(a)) { + return false + }return/^\s*\}/.test(h) + }; + this.autoOutdent = function(a, h) { + var i = a.getLine(h).match(/^(\s*\})/); + if(!i) { + return 0 + }i = i[1].length; + var e = a.findMatchingBracket({row:h, column:i}); + if(!e || e.row == h) { + return 0 + }e = this.$getIndent(a.getLine(e.row)); + a.replace(new k(h, 0, h, i - 1), e); + return e.length - (i - 1) + }; + this.$getIndent = function(a) { + if(a = a.match(/^(\s+)/)) { + return a[1] + }return"" + } + }).call(f.prototype); + return f +}); +require.def("ace/mode/JavaScript", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/JavaScriptHighlightRules", "ace/mode/MatchingBraceOutdent", "ace/Range"], function(k, f, a, h, i, e) { + var j = function() { + this.$tokenizer = new a((new h).getRules()); + this.$outdent = new i + }; + k.inherits(j, f); + (function() { + this.toggleCommentLines = function(c, g, l) { + var m = true; + c = /^(\s*)\/\//; + for(var b = l.start.row;b <= l.end.row;b++) { + if(!c.test(g.getLine(b))) { + m = false; + break + } + }if(m) { + m = new e(0, 0, 0, 0); + for(b = l.start.row;b <= l.end.row;b++) { + var d = g.getLine(b).replace(c, "$1"); + m.start.row = b; + m.end.row = b; + m.end.column = d.length + 2; + g.replace(m, d) + }return-2 + }else { + return g.indentRows(l, "//") + } + }; + this.getNextLineIndent = function(c, g, l) { + var m = this.$getIndent(g), b = this.$tokenizer.getLineTokens(g, c), d = b.tokens; + b = b.state; + if(d.length && d[d.length - 1].type == "comment") { + return m + }if(c == "start") { + if(c = g.match(/^.*[\{\(\[]\s*$/)) { + m += l + } + }else { + if(c == "doc-start") { + if(b == "start") { + return"" + }if(c = g.match(/^\s*(\/?)\*/)) { + if(c[1]) { + m += " " + }m += "* " + } + } + }return m + }; + this.checkOutdent = function(c, g, l) { + return this.$outdent.checkOutdent(g, l) + }; + this.autoOutdent = function(c, g, l) { + return this.$outdent.autoOutdent(g, l) + } + }).call(j.prototype); + return j +}); +require.def("ace/theme/TextMate", ["ace/lib/dom", "text!ace/theme/tm.css!.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-tm .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-tm .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-tm .ace_editor .ace_printMargin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_text-layer {\n cursor: text;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgb(153, 0, 0);\n color: white;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0) \n}"], +function(k, f) { + k.importCssString(f); + return{cssClass:"ace-tm"} +}); \ No newline at end of file diff --git a/build/ace/KeyBinding.js b/build/ace/KeyBinding.js new file mode 100644 index 00000000..630b8b96 --- /dev/null +++ b/build/ace/KeyBinding.js @@ -0,0 +1,57 @@ +/* + LGPLv3 +*/ +require.def("ace/KeyBinding", ["ace/lib/core", "ace/lib/event", "ace/conf/keybindings/default_mac", "ace/conf/keybindings/default_win", "ace/PluginManager", "ace/commands/DefaultCommands"], function(m, k, n, o, p) { + var l = function(i, g, j) { + this.setConfig(j); + var a = this; + k.addKeyListener(i, function(b) { + var c = (a.config.reverse[0 | (b.ctrlKey ? 1 : 0) | (b.altKey ? 2 : 0) | (b.shiftKey ? 4 : 0) | (b.metaKey ? 8 : 0)] || {})[(a.keyNames[b.keyCode] || String.fromCharCode(b.keyCode)).toLowerCase()]; + if(c = p.commands[c]) { + c(g, g.getSelection()); + return k.stopEvent(b) + } + }) + }; + (function() { + function i(a, b, c, e) { + return(e && a.toLowerCase() || a).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + b + "[\\s ]*", "g"), c || 999) + } + function g(a, b, c) { + var e, f = 0; + a = i(a, "\\-", null, true); + for(var d = 0, h = a.length;d < h;++d) { + if(this.keyMods[a[d]]) { + f |= this.keyMods[a[d]] + }else { + e = a[d] || "-" + } + }(c[f] || (c[f] = {}))[e] = b; + return c + } + function j(a, b) { + var c, e, f, d, h = {}; + for(c in a) { + d = a[c]; + if(b && typeof d == "string") { + d = d.split(b); + e = 0; + for(f = d.length;e < f;++e) { + g.call(this, d[e], c, h) + } + }else { + g.call(this, d, c, h) + } + }return h + } + this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8}; + this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"}; + this.setConfig = function(a) { + this.config = a || (m.isMac ? n : o); + if(typeof this.config.reverse == "undefined") { + this.config.reverse = j.call(this, this.config, "|") + } + } + }).call(l.prototype); + return l +}); \ No newline at end of file diff --git a/build/ace/MEventEmitter.js b/build/ace/MEventEmitter.js new file mode 100644 index 00000000..488095fa --- /dev/null +++ b/build/ace/MEventEmitter.js @@ -0,0 +1,33 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/MEventEmitter", ["ace/lib/lang"], function(e) { + var d = {}; + d.$dispatchEvent = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + var c = this.$eventRegistry[a]; + if(c && c.length) { + b = b || {}; + b.type = a; + for(a = 0;a < c.length;a++) { + c[a](b) + } + } + }; + d.on = d.addEventListener = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + var c = this.$eventRegistry[a]; + c || (c = this.$eventRegistry[a] = []); + e.arrayIndexOf(c, b) == -1 && c.push(b) + }; + d.removeEventListener = function(a, b) { + this.$eventRegistry = this.$eventRegistry || {}; + if(a = this.$eventRegistry[a]) { + b = e.arrayIndexOf(a, b); + b !== -1 && a.splice(b, 1) + } + }; + return d +}); \ No newline at end of file diff --git a/build/ace/PluginManager.js b/build/ace/PluginManager.js new file mode 100644 index 00000000..0378800b --- /dev/null +++ b/build/ace/PluginManager.js @@ -0,0 +1,8 @@ +/* + LGPLv3 +*/ +require.def("ace/PluginManager", [], function() { + return{commands:{}, registerCommand:function(a, b) { + this.commands[a] = b + }} +}); \ No newline at end of file diff --git a/build/ace/Range.js b/build/ace/Range.js new file mode 100644 index 00000000..e3268974 --- /dev/null +++ b/build/ace/Range.js @@ -0,0 +1,71 @@ +/* + LGPLv3 +*/ +require.def("ace/Range", function() { + var c = function(a, b, d, e) { + this.start = {row:a, column:b}; + this.end = {row:d, column:e} + }; + (function() { + this.toString = function() { + return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]" + }; + this.contains = function(a, b) { + return this.compare(a, b) == 0 + }; + this.compare = function(a, b) { + if(!this.isMultiLine()) { + if(a === this.start.row) { + return b < this.start.column ? -1 : b > this.end.column ? 1 : 0 + } + }if(a < this.start.row) { + return-1 + }if(a > this.end.row) { + return 1 + }if(this.start.row === a) { + return b >= this.start.column ? 0 : -1 + }if(this.end.row === a) { + return b <= this.end.column ? 0 : 1 + }return 0 + }; + this.clipRows = function(a, b) { + if(this.end.row > b) { + var d = {row:b + 1, column:0} + }if(this.start.row > b) { + var e = {row:b + 1, column:0} + }if(this.start.row < a) { + e = {row:a, column:0} + }if(this.end.row < a) { + d = {row:a, column:0} + }return c.fromPoints(e || this.start, d || this.end) + }; + this.extend = function(a, b) { + var d = this.compare(a, b); + if(d == 0) { + return this + }else { + if(d == -1) { + var e = {row:a, column:b} + }else { + var f = {row:a, column:b} + } + }return c.fromPoints(e || this.start, f || this.end) + }; + this.isEmpty = function() { + return this.start.row == this.end.row && this.start.column == this.end.column + }; + this.isMultiLine = function() { + return this.start.row !== this.end.row + }; + this.clone = function() { + return c.fromPoints(this.start, this.end) + }; + this.toScreenRange = function(a) { + return new c(this.start.row, a.documentToScreenColumn(this.start.row, this.start.column), this.end.row, a.documentToScreenColumn(this.end.row, this.end.column)) + } + }).call(c.prototype); + c.fromPoints = function(a, b) { + return new c(a.row, a.column, b.row, b.column) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/RenderLoop.js b/build/ace/RenderLoop.js new file mode 100644 index 00000000..0d7ed9b1 --- /dev/null +++ b/build/ace/RenderLoop.js @@ -0,0 +1,45 @@ +/* + LGPLv3 +*/ +require.def("ace/RenderLoop", function() { + var d = function(b) { + this.onRender = b; + this.pending = false; + this.changes = 0 + }; + (function() { + this.schedule = function(b) { + this.changes |= b; + if(!this.pending) { + this.pending = true; + var a = this; + this.setTimeoutZero(function() { + a.pending = false; + a.onRender(a.changes); + a.changes = 0 + }) + } + }; + if(window.postMessage) { + this.messageName = "zero-timeout-message"; + this.setTimeoutZero = function(b) { + if(!this.attached) { + var a = this; + window.addEventListener("message", function(c) { + if(c.source == window && a.callback && c.data == a.messageName) { + c.stopPropagation(); + a.callback() + } + }, false); + this.attached = true + }this.callback = b; + window.postMessage(this.messageName, "*") + } + }else { + this.setTimeoutZero = function(b) { + setTimeout(b, 0) + } + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/ScrollBar.js b/build/ace/ScrollBar.js new file mode 100644 index 00000000..8d5cee59 --- /dev/null +++ b/build/ace/ScrollBar.js @@ -0,0 +1,34 @@ +/* + LGPLv3 +*/ +require.def("ace/ScrollBar", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/MEventEmitter"], function(c, d, e, f, g) { + var b = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_sb"; + this.inner = document.createElement("div"); + this.element.appendChild(this.inner); + a.appendChild(this.element); + this.width = e.scrollbarWidth(); + this.element.style.width = this.width; + f.addListener(this.element, "scroll", d.bind(this.onScroll, this)) + }; + (function() { + c.implement(this, g); + this.onScroll = function() { + this.$dispatchEvent("scroll", {data:this.element.scrollTop}) + }; + this.getWidth = function() { + return this.width + }; + this.setHeight = function(a) { + this.element.style.height = Math.max(0, a - this.width) + "px" + }; + this.setInnerHeight = function(a) { + this.inner.style.height = a + "px" + }; + this.setScrollTop = function(a) { + this.element.scrollTop = a + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/Search.js b/build/ace/Search.js new file mode 100644 index 00000000..a8c334c3 --- /dev/null +++ b/build/ace/Search.js @@ -0,0 +1,152 @@ +/* + LGPLv3 +*/ +require.def("ace/Search", ["ace/lib/lang", "ace/lib/oop", "ace/Range"], function(o, q, r) { + var l = function() { + this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:l.ALL, regExp:false} + }; + l.ALL = 1; + l.SELECTION = 2; + (function() { + this.set = function(a) { + q.mixin(this.$options, a); + return this + }; + this.getOptions = function() { + return o.copyObject(this.$options) + }; + this.find = function(a) { + if(!this.$options.needle) { + return null + }var b = null; + (this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) { + b = c; + return true + }); + return b + }; + this.findAll = function(a) { + if(!this.$options.needle) { + return[] + }var b = []; + (this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) { + b.push(c) + }); + return b + }; + this.replace = function(a, b) { + var c = this.$assembleRegExp(), g = c.exec(a); + return g && g[0].length == a.length ? this.$options.regExp ? a.replace(c, b) : b : null + }; + this.$forwardMatchIterator = function(a) { + var b = this.$assembleRegExp(), c = this; + return{forEach:function(g) { + c.$forwardLineIterator(a).forEach(function(d, i, k) { + if(i) { + d = d.substring(i) + }var j = []; + d.replace(b, function(e) { + j.push({str:e, offset:i + arguments[arguments.length - 2]}); + return e + }); + for(d = 0;d < j.length;d++) { + var h = j[d]; + h = c.$rangeFromMatch(k, h.offset, h.str.length); + if(g(h)) { + return true + } + } + }) + }} + }; + this.$backwardMatchIterator = function(a) { + var b = this.$assembleRegExp(), c = this; + return{forEach:function(g) { + c.$backwardLineIterator(a).forEach(function(d, i, k) { + if(i) { + d = d.substring(i) + }var j = []; + d.replace(b, function(e, f) { + j.push({str:e, offset:i + f}); + return e + }); + for(d = j.length - 1;d >= 0;d--) { + var h = j[d]; + h = c.$rangeFromMatch(k, h.offset, h.str.length); + if(g(h)) { + return true + } + } + }) + }} + }; + this.$rangeFromMatch = function(a, b, c) { + return new r(a, b, a, b + c) + }; + this.$assembleRegExp = function() { + var a = this.$options.regExp ? this.$options.needle : o.escapeRegExp(this.$options.needle); + if(this.$options.wholeWord) { + a = "\\b" + a + "\\b" + }var b = "g"; + this.$options.caseSensitive || (b += "i"); + return new RegExp(a, b) + }; + this.$forwardLineIterator = function(a) { + function b(e) { + var f = a.getLine(e); + if(c && e == g.end.row) { + f = f.substring(0, g.end.column) + }return f + } + var c = this.$options.scope == l.SELECTION, g = a.getSelection().getRange(), d = a.getSelection().getCursor(), i = c ? g.start.row : 0, k = c ? g.start.column : 0, j = c ? g.end.row : a.getLength() - 1, h = this.$options.wrap; + return{forEach:function(e) { + for(var f = d.row, m = b(f), n = d.column, p = false;!e(m, n, f);) { + if(p) { + return + }f++; + n = 0; + if(f > j) { + if(h) { + f = i; + n = k + }else { + return + } + }if(f == d.row) { + p = true + }m = b(f) + } + }} + }; + this.$backwardLineIterator = function(a) { + var b = this.$options.scope == l.SELECTION, c = a.getSelection().getRange(), g = b ? c.end : c.start, d = b ? c.start.row : 0, i = b ? c.start.column : 0, k = b ? c.end.row : a.getLength() - 1, j = this.$options.wrap; + return{forEach:function(h) { + for(var e = g.row, f = a.getLine(e).substring(0, g.column), m = 0, n = false;!h(f, m, e);) { + if(n) { + return + }e--; + m = 0; + if(e < d) { + if(j) { + e = k + }else { + return + } + }if(e == g.row) { + n = true + }f = a.getLine(e); + if(b) { + if(e == d) { + m = i + }else { + if(e == k) { + f = f.substring(0, c.end.column) + } + } + } + } + }} + } + }).call(l.prototype); + return l +}); \ No newline at end of file diff --git a/build/ace/Selection.js b/build/ace/Selection.js new file mode 100644 index 00000000..b401b0e4 --- /dev/null +++ b/build/ace/Selection.js @@ -0,0 +1,257 @@ +/* + LGPLv3 +*/ +require.def("ace/Selection", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Range"], function(g, h, i, e) { + var f = function(a) { + this.doc = a; + this.clearSelection(); + this.selectionLead = {row:0, column:0} + }; + (function() { + g.implement(this, i); + this.isEmpty = function() { + return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column + }; + this.isMultiLine = function() { + if(this.isEmpty()) { + return false + }return this.getRange().isMultiLine() + }; + this.getCursor = function() { + return this.selectionLead + }; + this.setSelectionAnchor = function(a, b) { + a = this.$clipPositionToDocument(a, b); + if(this.selectionAnchor) { + if(this.selectionAnchor.row !== a.row || this.selectionAnchor.column !== a.column) { + this.selectionAnchor = a; + this.$dispatchEvent("changeSelection", {}) + } + }else { + this.selectionAnchor = a; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.getSelectionAnchor = function() { + return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead) + }; + this.getSelectionLead = function() { + return this.$clone(this.selectionLead) + }; + this.shiftSelection = function(a) { + if(this.isEmpty()) { + this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + a) + }else { + var b = this.getSelectionAnchor(), c = this.getSelectionLead(), d = this.isBackwards(); + if(!d || b.column !== 0) { + this.setSelectionAnchor(b.row, b.column + a) + }if(d || c.column !== 0) { + this.$moveSelection(function() { + this.moveCursorTo(c.row, c.column + a) + }) + } + } + }; + this.isBackwards = function() { + var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead; + return a.row > b.row || a.row == b.row && a.column > b.column + }; + this.getRange = function() { + var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead; + return this.isBackwards() ? e.fromPoints(b, a) : e.fromPoints(a, b) + }; + this.clearSelection = function() { + if(this.selectionAnchor) { + this.selectionAnchor = null; + this.$dispatchEvent("changeSelection", {}) + } + }; + this.selectAll = function() { + var a = this.doc.getLength() - 1; + this.setSelectionAnchor(a, this.doc.getLine(a).length); + this.$moveSelection(function() { + this.moveCursorTo(0, 0) + }) + }; + this.setSelectionRange = function(a, b) { + if(b) { + this.setSelectionAnchor(a.end.row, a.end.column); + this.selectTo(a.start.row, a.start.column) + }else { + this.setSelectionAnchor(a.start.row, a.start.column); + this.selectTo(a.end.row, a.end.column) + } + }; + this.$moveSelection = function(a) { + var b = false; + if(!this.selectionAnchor) { + b = true; + this.selectionAnchor = this.$clone(this.selectionLead) + }var c = this.$clone(this.selectionLead); + a.call(this); + if(c.row !== this.selectionLead.row || c.column !== this.selectionLead.column) { + b = true + }b && this.$dispatchEvent("changeSelection", {}) + }; + this.selectTo = function(a, b) { + this.$moveSelection(function() { + this.moveCursorTo(a, b) + }) + }; + this.selectToPosition = function(a) { + this.$moveSelection(function() { + this.moveCursorToPosition(a) + }) + }; + this.selectUp = function() { + this.$moveSelection(this.moveCursorUp) + }; + this.selectDown = function() { + this.$moveSelection(this.moveCursorDown) + }; + this.selectRight = function() { + this.$moveSelection(this.moveCursorRight) + }; + this.selectLeft = function() { + this.$moveSelection(this.moveCursorLeft) + }; + this.selectLineStart = function() { + this.$moveSelection(this.moveCursorLineStart) + }; + this.selectLineEnd = function() { + this.$moveSelection(this.moveCursorLineEnd) + }; + this.selectFileEnd = function() { + this.$moveSelection(this.moveCursorFileEnd) + }; + this.selectFileStart = function() { + this.$moveSelection(this.moveCursorFileStart) + }; + this.selectWordRight = function() { + this.$moveSelection(this.moveCursorWordRight) + }; + this.selectWordLeft = function() { + this.$moveSelection(this.moveCursorWordLeft) + }; + this.selectWord = function() { + var a = this.selectionLead; + this.setSelectionRange(this.doc.getWordRange(a.row, a.column)) + }; + this.selectLine = function() { + this.setSelectionAnchor(this.selectionLead.row, 0); + this.$moveSelection(function() { + this.moveCursorTo(this.selectionLead.row + 1, 0) + }) + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.moveCursorDown = function() { + this.moveCursorBy(1, 0) + }; + this.moveCursorLeft = function() { + if(this.selectionLead.column == 0) { + this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length) + }else { + this.moveCursorBy(0, -1) + } + }; + this.moveCursorRight = function() { + if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) { + this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0) + }else { + this.moveCursorBy(0, 1) + } + }; + this.moveCursorLineStart = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a).slice(0, b).match(/^\s*/); + if(c[0].length == 0) { + this.moveCursorTo(a, this.doc.getLine(a).match(/^\s*/)[0].length) + }else { + c[0].length >= b ? this.moveCursorTo(a, 0) : this.moveCursorTo(a, c[0].length) + } + }; + this.moveCursorLineEnd = function() { + this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length) + }; + this.moveCursorFileEnd = function() { + var a = this.doc.getLength() - 1, b = this.doc.getLine(a).length; + this.moveCursorTo(a, b) + }; + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0) + }; + this.moveCursorWordRight = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a), d = c.substring(b); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(b == c.length) { + this.moveCursorRight() + }else { + if(this.doc.nonTokenRe.exec(d)) { + b += this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(d)) { + b += this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(a, b) + } + }; + this.moveCursorWordLeft = function() { + var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a); + c = h.stringReverse(c.substring(0, b)); + this.doc.nonTokenRe.lastIndex = 0; + this.doc.tokenRe.lastIndex = 0; + if(b == 0) { + this.moveCursorLeft() + }else { + if(this.doc.nonTokenRe.exec(c)) { + b -= this.doc.nonTokenRe.lastIndex; + this.doc.nonTokenRe.lastIndex = 0 + }else { + if(this.doc.tokenRe.exec(c)) { + b -= this.doc.tokenRe.lastIndex; + this.doc.tokenRe.lastIndex = 0 + } + }this.moveCursorTo(a, b) + } + }; + this.moveCursorBy = function(a, b) { + this.moveCursorTo(this.selectionLead.row + a, this.selectionLead.column + b) + }; + this.moveCursorToPosition = function(a) { + this.moveCursorTo(a.row, a.column) + }; + this.moveCursorTo = function(a, b) { + a = this.$clipPositionToDocument(a, b); + if(a.row !== this.selectionLead.row || a.column !== this.selectionLead.column) { + this.selectionLead = a; + this.$dispatchEvent("changeCursor", {data:this.getCursor()}) + } + }; + this.moveCursorUp = function() { + this.moveCursorBy(-1, 0) + }; + this.$clipPositionToDocument = function(a, b) { + var c = {}; + if(a >= this.doc.getLength()) { + c.row = Math.max(0, this.doc.getLength() - 1); + c.column = this.doc.getLine(c.row).length + }else { + if(a < 0) { + c.row = 0; + c.column = 0 + }else { + c.row = a; + c.column = Math.min(this.doc.getLine(c.row).length, Math.max(0, b)) + } + }return c + }; + this.$clone = function(a) { + return{row:a.row, column:a.column} + } + }).call(f.prototype); + return f +}); \ No newline at end of file diff --git a/build/ace/TextInput.js b/build/ace/TextInput.js new file mode 100644 index 00000000..e34a8351 --- /dev/null +++ b/build/ace/TextInput.js @@ -0,0 +1,81 @@ +/* + LGPLv3 +*/ +require.def("ace/TextInput", ["ace/lib/event"], function(b) { + return function(l, c) { + function e() { + if(!f) { + var d = a.value; + if(d) { + if(d.charCodeAt(d.length - 1) == j.charCodeAt(0)) { + (d = d.slice(0, -1)) && c.onTextInput(d) + }else { + c.onTextInput(d) + } + } + }f = false; + a.value = j; + a.select() + } + var a = document.createElement("textarea"), h = a.style; + h.position = "absolute"; + h.left = "-10000px"; + h.top = "-10000px"; + l.appendChild(a); + var j = String.fromCharCode(0); + e(); + var i = false, f = false, g = function() { + setTimeout(function() { + i || e() + }, 0) + }, k = function() { + c.onCompositionUpdate(a.value) + }; + b.addListener(a, "keypress", g); + b.addListener(a, "textInput", g); + b.addListener(a, "paste", g); + b.addListener(a, "propertychange", g); + b.addListener(a, "copy", function() { + f = true; + a.value = c.getCopyText(); + a.select(); + f = true; + setTimeout(e, 0) + }); + b.addListener(a, "cut", function() { + f = true; + a.value = c.getCopyText(); + c.onCut(); + a.select(); + setTimeout(e, 0) + }); + b.addListener(a, "compositionstart", function() { + i = true; + e(); + a.value = ""; + c.onCompositionStart(); + setTimeout(k, 0) + }); + b.addListener(a, "compositionupdate", k); + b.addListener(a, "compositionend", function() { + i = false; + c.onCompositionEnd(); + g() + }); + b.addListener(a, "blur", function() { + c.onBlur() + }); + b.addListener(a, "focus", function() { + c.onFocus(); + a.select() + }); + this.focus = function() { + c.onFocus(); + a.select(); + a.focus() + }; + this.blur = function() { + a.blur() + } + } +}); \ No newline at end of file diff --git a/build/ace/Tokenizer.js b/build/ace/Tokenizer.js new file mode 100644 index 00000000..c651721a --- /dev/null +++ b/build/ace/Tokenizer.js @@ -0,0 +1,49 @@ +/* + LGPLv3 +*/ +require.def("ace/Tokenizer", [], function() { + var k = function(f) { + this.rules = f; + this.regExps = {}; + for(var a in this.rules) { + f = this.rules[a]; + for(var b = [], c = 0;c < f.length;c++) { + b.push(f[c].regex) + }this.regExps[a] = new RegExp("(?:(" + b.join(")|(") + ")|(.))", "g") + } + }; + (function() { + this.getLineTokens = function(f, a) { + a = a; + var b = this.rules[a], c = this.regExps[a]; + c.lastIndex = 0; + for(var g, h = [], i = 0, e = {type:null, value:""};g = c.exec(f);) { + var j = "text", l = g[0]; + if(c.lastIndex == i) { + throw new Error("tokenizer error"); + }i = c.lastIndex; + window.LOG && console.log(a, g); + for(var d = 0;d < b.length;d++) { + if(g[d + 1]) { + j = typeof b[d].token == "function" ? b[d].token(g[0]) : b[d].token; + if(b[d].next && b[d].next !== a) { + a = b[d].next; + b = this.rules[a]; + i = c.lastIndex; + c = this.regExps[a]; + c.lastIndex = i + }break + } + }if(e.type !== j) { + e.type && h.push(e); + e = {type:j, value:l} + }else { + e.value += l + } + }e.type && h.push(e); + window.LOG && console.log(h, a); + return{tokens:h, state:a} + } + }).call(k.prototype); + return k +}); \ No newline at end of file diff --git a/build/ace/UndoManager.js b/build/ace/UndoManager.js new file mode 100644 index 00000000..e7b54308 --- /dev/null +++ b/build/ace/UndoManager.js @@ -0,0 +1,31 @@ +/* + LGPLv3 +*/ +require.def("ace/UndoManager", function() { + var b = function() { + this.$undoStack = []; + this.$redoStack = [] + }; + (function() { + this.execute = function(a) { + var c = a.args[0]; + this.$doc = a.args[1]; + this.$undoStack.push(c) + }; + this.undo = function() { + var a = this.$undoStack.pop(); + if(a) { + this.$doc.undoChanges(a); + this.$redoStack.push(a) + } + }; + this.redo = function() { + var a = this.$redoStack.pop(); + if(a) { + this.$doc.redoChanges(a); + this.$undoStack.push(a) + } + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/VirtualRenderer.js b/build/ace/VirtualRenderer.js new file mode 100644 index 00000000..07b07452 --- /dev/null +++ b/build/ace/VirtualRenderer.js @@ -0,0 +1,378 @@ +/* + LGPLv3 +*/ +require.def("ace/VirtualRenderer", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/layer/Gutter", "ace/layer/Marker", "ace/layer/Text", "ace/layer/Cursor", "ace/ScrollBar", "ace/RenderLoop", "ace/MEventEmitter", 'text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}'], +function(k, h, e, i, l, m, n, o, p, q, r, j) { + e.importCssString(j); + j = function(a, b) { + this.container = a; + e.addCssClass(this.container, "ace_editor"); + this.setTheme(b); + this.scroller = document.createElement("div"); + this.scroller.className = "ace_scroller"; + this.container.appendChild(this.scroller); + this.$gutter = document.createElement("div"); + this.$gutter.className = "ace_gutter"; + this.container.appendChild(this.$gutter); + this.content = document.createElement("div"); + this.content.style.position = "absolute"; + this.scroller.appendChild(this.content); + this.$gutterLayer = new l(this.$gutter); + this.$markerLayer = new m(this.content); + var c = this.$textLayer = new n(this.content); + this.canvas = c.element; + this.characterWidth = c.getCharacterWidth(); + this.lineHeight = c.getLineHeight(); + this.$cursorLayer = new o(this.content); + this.layers = [this.$markerLayer, c, this.$cursorLayer]; + this.scrollBar = new p(a); + this.scrollBar.addEventListener("scroll", h.bind(this.onScroll, this)); + this.scrollTop = 0; + this.cursorPos = {row:0, column:0}; + var d = this; + this.$textLayer.addEventListener("changeCharaterSize", function() { + d.characterWidth = c.getCharacterWidth(); + d.lineHeight = c.getLineHeight(); + d.$loop.schedule(d.CHANGE_FULL) + }); + i.addListener(this.$gutter, "click", h.bind(this.$onGutterClick, this)); + i.addListener(this.$gutter, "dblclick", h.bind(this.$onGutterClick, this)); + this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0}; + this.$loop = new q(h.bind(this.$renderChanges, this)); + this.$loop.schedule(this.CHANGE_FULL); + this.$updatePrintMargin(); + this.setPadding(4) + }; + (function() { + this.showGutter = true; + this.CHANGE_CURSOR = 1; + this.CHANGE_MARKER = 2; + this.CHANGE_GUTTER = 4; + this.CHANGE_SCROLL = 8; + this.CHANGE_LINES = 16; + this.CHANGE_TEXT = 32; + this.CHANGE_SIZE = 64; + this.CHANGE_FULL = 128; + k.implement(this, r); + this.setDocument = function(a) { + this.lines = a.lines; + this.doc = a; + this.$cursorLayer.setDocument(a); + this.$markerLayer.setDocument(a); + this.$textLayer.setDocument(a); + this.$loop.schedule(this.CHANGE_FULL) + }; + this.updateLines = function(a, b) { + if(b === undefined) { + b = Infinity + }if(this.$changedLines) { + if(this.$changedLines.firstRow > a) { + this.$changedLines.firstRow = a + }if(this.$changedLines.lastRow < b) { + this.$changedLines.lastRow = b + } + }else { + this.$changedLines = {firstRow:a, lastRow:b} + }this.$loop.schedule(this.CHANGE_LINES) + }; + this.updateText = function() { + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.updateFull = function() { + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onResize = function() { + this.$loop.schedule(this.CHANGE_SIZE); + var a = e.getInnerHeight(this.container); + if(this.$size.height != a) { + this.$size.height = a; + this.scroller.style.height = a + "px"; + this.scrollBar.setHeight(a); + if(this.doc) { + this.scrollToY(this.getScrollTop()); + this.$loop.schedule(this.CHANGE_FULL) + } + }a = e.getInnerWidth(this.container); + if(this.$size.width != a) { + this.$size.width = a; + var b = this.showGutter ? this.$gutter.offsetWidth : 0; + this.scroller.style.left = b + "px"; + this.scroller.style.width = Math.max(0, a - b - this.scrollBar.getWidth()) + "px" + }this.$size.scrollerWidth = this.scroller.clientWidth; + this.$size.scrollerHeight = this.scroller.clientHeight + }; + this.setTokenizer = function(a) { + this.$tokenizer = a; + this.$textLayer.setTokenizer(a); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.$onGutterClick = function(a) { + var b = i.getDocumentX(a), c = i.getDocumentY(a); + this.$dispatchEvent("gutter" + a.type, {row:this.screenToTextCoordinates(b, c).row, htmlEvent:a}) + }; + this.$showInvisibles = true; + this.setShowInvisibles = function(a) { + this.$showInvisibles = a; + this.$textLayer.setShowInvisibles(a); + this.$loop.schedule(this.CHANGE_TEXT) + }; + this.getShowInvisibles = function() { + return this.$showInvisibles + }; + this.$showPrintMargin = true; + this.setShowPrintMargin = function(a) { + this.$showPrintMargin = a; + this.$updatePrintMargin() + }; + this.getShowPrintMargin = function() { + return this.$showPrintMargin + }; + this.$printMarginColumn = 80; + this.setPrintMarginColumn = function(a) { + this.$printMarginColumn = a; + this.$updatePrintMargin() + }; + this.getPrintMarginColumn = function() { + return this.$printMarginColumn + }; + this.setShowGutter = function(a) { + this.$gutter.style.display = a ? "block" : "none"; + this.showGutter = a; + this.onResize() + }; + this.$updatePrintMargin = function() { + if(this.$showPrintMargin || this.$printMarginEl) { + if(!this.$printMarginEl) { + this.$printMarginEl = document.createElement("div"); + this.$printMarginEl.className = "ace_printMargin"; + this.content.insertBefore(this.$printMarginEl, this.$textLayer.element) + }var a = this.$printMarginEl.style; + a.left = this.characterWidth * this.$printMarginColumn + "px"; + a.visibility = this.$showPrintMargin ? "visible" : "hidden" + } + }; + this.getContainerElement = function() { + return this.container + }; + this.getMouseEventTarget = function() { + return this.content + }; + this.getFirstVisibleRow = function() { + return(this.layerConfig || {}).firstRow || 0 + }; + this.getFirstFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1) + }; + this.getLastFullyVisibleRow = function() { + if(!this.layerConfig) { + return 0 + }return this.layerConfig.firstRow - 1 + Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight) + }; + this.getLastVisibleRow = function() { + return(this.layerConfig || {}).lastRow || 0 + }; + this.$padding = null; + this.setPadding = function(a) { + this.$padding = a; + this.content.style.padding = "0 " + a + "px"; + this.$loop.schedule(this.CHANGE_FULL) + }; + this.onScroll = function(a) { + this.scrollToY(a.data) + }; + this.$updateScrollBar = function() { + this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight); + this.scrollBar.setScrollTop(this.scrollTop) + }; + this.$renderChanges = function(a) { + if(!(!a || !this.doc || !this.$tokenizer)) { + if(!this.layerConfig || a & this.CHANGE_FULL || a & this.CHANGE_SIZE || a & this.CHANGE_TEXT || a & this.CHANGE_LINES || a & this.CHANGE_SCROLL) { + this.$computeLayerConfig() + }if(a & this.CHANGE_FULL) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(a & this.CHANGE_SCROLL) { + a & this.CHANGE_TEXT || a & this.CHANGE_LINES ? this.$textLayer.scrollLines(this.layerConfig) : this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig); + this.$markerLayer.update(this.layerConfig); + this.$cursorLayer.update(this.layerConfig); + this.$updateScrollBar() + }else { + if(a & this.CHANGE_TEXT) { + this.$textLayer.update(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + }else { + if(a & this.CHANGE_LINES) { + this.$updateLines(); + this.$updateScrollBar() + }else { + if(a & this.CHANGE_SCROLL) { + this.$textLayer.scrollLines(this.layerConfig); + this.showGutter && this.$gutterLayer.update(this.layerConfig) + } + } + }a & this.CHANGE_GUTTER && this.showGutter && this.$gutterLayer.update(this.layerConfig); + a & this.CHANGE_CURSOR && this.$cursorLayer.update(this.layerConfig); + a & this.CHANGE_MARKER && this.$markerLayer.update(this.layerConfig); + a & this.CHANGE_SIZE && this.$updateScrollBar() + } + } + } + }; + this.$computeLayerConfig = function() { + var a = this.scrollTop % this.lineHeight, b = this.$size.scrollerHeight + this.lineHeight, c = this.$getLongestLine(), d = !this.layerConfig ? true : this.layerConfig.width != c, g = Math.ceil(b / this.lineHeight), f = Math.max(0, Math.round((this.scrollTop - a) / this.lineHeight)); + g = Math.min(this.lines.length, f + g) - 1; + this.layerConfig = {width:c, padding:this.$padding, firstRow:f, lastRow:g, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:b, offset:a, height:this.$size.scrollerHeight}; + for(f = 0;f < this.layers.length;f++) { + g = this.layers[f]; + if(d) { + g.element.style.width = c + "px" + } + }this.$gutterLayer.element.style.marginTop = -a + "px"; + this.content.style.marginTop = -a + "px"; + this.content.style.width = c + "px"; + this.content.style.height = b + "px" + }; + this.$updateLines = function() { + var a = this.$changedLines.firstRow, b = this.$changedLines.lastRow; + this.$changedLines = null; + var c = this.layerConfig; + if(c.width != this.$getLongestLine()) { + return this.$textLayer.update(c) + }if(!(a > c.lastRow + 1)) { + if(!(b < c.firstRow)) { + if(b === Infinity) { + this.showGutter && this.$gutterLayer.update(c); + this.$textLayer.update(c) + }else { + this.$textLayer.updateLines(c, a, b) + } + } + } + }; + this.$getLongestLine = function() { + var a = this.doc.getScreenWidth(); + if(this.$showInvisibles) { + a += 1 + }return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(a * this.characterWidth)) + }; + this.addMarker = function(a, b, c) { + a = this.$markerLayer.addMarker(a, b, c); + this.$loop.schedule(this.CHANGE_MARKER); + return a + }; + this.removeMarker = function(a) { + this.$markerLayer.removeMarker(a); + this.$loop.schedule(this.CHANGE_MARKER) + }; + this.addGutterDecoration = function(a, b) { + this.$gutterLayer.addGutterDecoration(a, b); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.removeGutterDecoration = function(a, b) { + this.$gutterLayer.removeGutterDecoration(a, b); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.setBreakpoints = function(a) { + this.$gutterLayer.setBreakpoints(a); + this.$loop.schedule(this.CHANGE_GUTTER) + }; + this.updateCursor = function(a, b) { + this.$cursorLayer.setCursor(a, b); + this.$loop.schedule(this.CHANGE_CURSOR) + }; + this.hideCursor = function() { + this.$cursorLayer.hideCursor() + }; + this.showCursor = function() { + this.$cursorLayer.showCursor() + }; + this.scrollCursorIntoView = function() { + var a = this.$cursorLayer.getPixelPosition(), b = a.left + this.$padding; + a = a.top; + this.getScrollTop() > a && this.scrollToY(a); + this.getScrollTop() + this.$size.scrollerHeight < a + this.lineHeight && this.scrollToY(a + this.lineHeight - this.$size.scrollerHeight); + this.scroller.scrollLeft > b && this.scrollToX(b); + this.scroller.scrollLeft + this.$size.scrollerWidth < b + this.characterWidth && this.scrollToX(Math.round(b + this.characterWidth - this.$size.scrollerWidth)) + }; + this.getScrollTop = function() { + return this.scrollTop + }; + this.getScrollLeft = function() { + return this.scroller.scrollLeft + }; + this.getScrollTopRow = function() { + return this.scrollTop / this.lineHeight + }; + this.scrollToRow = function(a) { + this.scrollToY(a * this.lineHeight) + }; + this.scrollToY = function(a) { + a = Math.max(0, Math.min(this.lines.length * this.lineHeight - this.$size.scrollerHeight, a)); + if(this.scrollTop !== a) { + this.scrollTop = a; + this.$loop.schedule(this.CHANGE_SCROLL) + } + }; + this.scrollToX = function(a) { + if(a <= this.$padding) { + a = 0 + }this.scroller.scrollLeft = a + }; + this.scrollBy = function(a, b) { + b && this.scrollToY(this.scrollTop + b); + a && this.scrollToX(this.scroller.scrollLeft + a) + }; + this.screenToTextCoordinates = function(a, b) { + var c = this.scroller.getBoundingClientRect(); + a = Math.round((a + this.scroller.scrollLeft - c.left - this.$padding) / this.characterWidth); + b = Math.floor((b + this.scrollTop - c.top) / this.lineHeight); + return{row:b, column:this.doc.screenToDocumentColumn(Math.max(0, Math.min(b, this.doc.getLength() - 1)), a)} + }; + this.textToScreenCoordinates = function(a, b) { + var c = this.scroller.getBoundingClientRect(); + b = this.padding + Math.round(this.doc.documentToScreenColumn(a, b) * this.characterWidth); + a = a * this.lineHeight; + return{pageX:c.left + b - this.getScrollLeft(), pageY:c.top + a - this.getScrollTop()} + }; + this.visualizeFocus = function() { + e.addCssClass(this.container, "ace_focus") + }; + this.visualizeBlur = function() { + e.removeCssClass(this.container, "ace_focus") + }; + this.showComposition = function() { + }; + this.setCompositionText = function() { + }; + this.hideComposition = function() { + }; + this.setTheme = function(a) { + function b(d) { + c.$theme && e.removeCssClass(c.container, c.$theme); + c.$theme = d ? d.cssClass : null; + c.$theme && e.addCssClass(c.container, c.$theme); + if(c.$size) { + c.$size.width = 0; + c.onResize() + } + } + var c = this; + if(!a || typeof a == "string") { + a = a || "ace/theme/TextMate"; + require([a], function(d) { + b(d) + }) + }else { + b(a) + }c = this + } + }).call(j.prototype); + return j +}); \ No newline at end of file diff --git a/build/ace/commands/DefaultCommands.js b/build/ace/commands/DefaultCommands.js new file mode 100644 index 00000000..263d0aa4 --- /dev/null +++ b/build/ace/commands/DefaultCommands.js @@ -0,0 +1,154 @@ +/* + LGPLv3 +*/ +require.def("ace/commands/DefaultCommands", ["ace/PluginManager"], function(b) { + b.registerCommand("selectall", function(a, c) { + c.selectAll() + }); + b.registerCommand("removeline", function(a) { + a.removeLines() + }); + b.registerCommand("gotoline", function(a) { + var c = parseInt(prompt("Enter line number:")); + isNaN(c) || a.gotoLine(c) + }); + b.registerCommand("togglecomment", function(a) { + a.toggleCommentLines() + }); + b.registerCommand("findnext", function(a) { + a.findNext() + }); + b.registerCommand("findprevious", function(a) { + a.findPrevious() + }); + b.registerCommand("find", function(a) { + var c = prompt("Find:"); + a.find(c) + }); + b.registerCommand("undo", function(a) { + a.undo() + }); + b.registerCommand("redo", function(a) { + a.redo() + }); + b.registerCommand("redo", function(a) { + a.redo() + }); + b.registerCommand("overwrite", function(a) { + a.toggleOverwrite() + }); + b.registerCommand("copylinesup", function(a) { + a.copyLinesUp() + }); + b.registerCommand("movelinesup", function(a) { + a.moveLinesUp() + }); + b.registerCommand("selecttostart", function(a, c) { + c.selectFileStart() + }); + b.registerCommand("gotostart", function(a) { + a.navigateFileStart() + }); + b.registerCommand("selectup", function(a, c) { + c.selectUp() + }); + b.registerCommand("golineup", function(a) { + a.navigateUp() + }); + b.registerCommand("copylinesdown", function(a) { + a.copyLinesDown() + }); + b.registerCommand("movelinesdown", function(a) { + a.moveLinesDown() + }); + b.registerCommand("selecttoend", function(a, c) { + c.selectFileEnd() + }); + b.registerCommand("gotoend", function(a) { + a.navigateFileEnd() + }); + b.registerCommand("selectdown", function(a, c) { + c.selectDown() + }); + b.registerCommand("godown", function(a) { + a.navigateDown() + }); + b.registerCommand("selectwordleft", function(a, c) { + c.selectWordLeft() + }); + b.registerCommand("gotowordleft", function(a) { + a.navigateWordLeft() + }); + b.registerCommand("selecttolinestart", function(a, c) { + c.selectLineStart() + }); + b.registerCommand("gotolinestart", function(a) { + a.navigateLineStart() + }); + b.registerCommand("selectleft", function(a, c) { + c.selectLeft() + }); + b.registerCommand("gotoleft", function(a) { + a.navigateLeft() + }); + b.registerCommand("selectwordright", function(a, c) { + c.selectWordRight() + }); + b.registerCommand("gotowordright", function(a) { + a.navigateWordRight() + }); + b.registerCommand("selecttolineend", function(a, c) { + c.selectLineEnd() + }); + b.registerCommand("gotolineend", function(a) { + a.navigateLineEnd() + }); + b.registerCommand("selectright", function(a, c) { + c.selectRight() + }); + b.registerCommand("gotoright", function(a) { + a.navigateRight() + }); + b.registerCommand("selectpagedown", function(a) { + a.selectPageDown() + }); + b.registerCommand("pagedown", function(a) { + a.scrollPageDown() + }); + b.registerCommand("gotopagedown", function(a) { + a.gotoPageDown() + }); + b.registerCommand("selectpageup", function(a) { + a.selectPageUp() + }); + b.registerCommand("pageup", function(a) { + a.scrollPageUp() + }); + b.registerCommand("gotopageup", function(a) { + a.gotoPageUp() + }); + b.registerCommand("selectlinestart", function(a, c) { + c.selectLineStart() + }); + b.registerCommand("gotolinestart", function(a) { + a.navigateLineStart() + }); + b.registerCommand("selectlineend", function(a, c) { + c.selectLineEnd() + }); + b.registerCommand("gotolineend", function(a) { + a.navigateLineEnd() + }); + b.registerCommand("del", function(a) { + a.removeRight() + }); + b.registerCommand("backspace", function(a) { + a.removeLeft() + }); + b.registerCommand("outdent", function(a) { + a.blockOutdent() + }); + b.registerCommand("indent", function(a) { + a.indent() + }) +}); \ No newline at end of file diff --git a/build/ace/conf/keybindings/default_mac.js b/build/ace/conf/keybindings/default_mac.js new file mode 100644 index 00000000..bedb40f1 --- /dev/null +++ b/build/ace/conf/keybindings/default_mac.js @@ -0,0 +1,8 @@ +/* + LGPLv3 +*/ +require.def("ace/conf/keybindings/default_mac", function() { + return{selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down", + selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", + pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); \ No newline at end of file diff --git a/build/ace/conf/keybindings/default_win.js b/build/ace/conf/keybindings/default_win.js new file mode 100644 index 00000000..bcec8dd3 --- /dev/null +++ b/build/ace/conf/keybindings/default_win.js @@ -0,0 +1,8 @@ +/* + LGPLv3 +*/ +require.def("ace/conf/keybindings/default_win", function() { + return{selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Ctrl-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Ctrl-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", + selectdown:"Shift-Down", godown:"Down", selectwordleft:"Alt-Shift-Left", gotowordleft:"Alt-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Ctrl-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Alt-Shift-Right", gotowordright:"Alt-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Ctrl-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", + selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"} +}); \ No newline at end of file diff --git a/build/ace/css/editor.css b/build/ace/css/editor.css new file mode 100644 index 00000000..b8125397 --- /dev/null +++ b/build/ace/css/editor.css @@ -0,0 +1,71 @@ +.ace_editor { + position: absolute; + overflow: hidden; + font-family: "Menlo", "Monaco", "Courier New", monospace; + font-size: 12px; +} +.ace_scroller { + position: absolute; + overflow-x: scroll; + overflow-y: hidden; +} +.ace_gutter { + position: absolute; + overflow-x: hidden; + overflow-y: hidden; + height: 100%; +} +.ace_editor .ace_sb { + position: absolute; + overflow-x: hidden; + overflow-y: scroll; + right: 0; +} +.ace_editor .ace_sb div { + position: absolute; + width: 1px; + left: 0px; +} +.ace_editor .ace_printMargin { + position: absolute; + height: 100%; +} +.ace_layer { + z-index: 0; + position: absolute; + overflow: hidden; + white-space: nowrap; + height: 100%; +} +.ace_text-layer { + font-family: Monaco, "Courier New", monospace; + color: black; +} +.ace_cursor-layer { + cursor: text; +} +.ace_cursor { + z-index: 3; + position: absolute; +} +.ace_line { + white-space: nowrap; +} +.ace_marker-layer { +} +.ace_marker-layer .ace_step { + position: absolute; + z-index: 2; +} +.ace_marker-layer .ace_selection { + position: absolute; + z-index: 3; +} +.ace_marker-layer .ace_bracket { + position: absolute; + z-index: 4; +} +.ace_marker-layer .ace_active_line { + position: absolute; + z-index: 1; +} diff --git a/build/ace/layer/Cursor.js b/build/ace/layer/Cursor.js new file mode 100644 index 00000000..433092f9 --- /dev/null +++ b/build/ace/layer/Cursor.js @@ -0,0 +1,65 @@ +/* + LGPLv3 +*/ +require.def("ace/layer/Cursor", ["ace/lib/dom"], function(c) { + var d = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + a.appendChild(this.element); + this.cursor = document.createElement("div"); + this.cursor.className = "ace_cursor"; + this.isVisible = false + }; + (function() { + this.setDocument = function(a) { + this.doc = a + }; + this.setCursor = function(a, b) { + this.position = {row:a.row, column:this.doc.documentToScreenColumn(a.row, a.column)}; + b ? c.addCssClass(this.cursor, "ace_overwrite") : c.removeCssClass(this.cursor, "ace_overwrite") + }; + this.hideCursor = function() { + this.isVisible = false; + this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor); + clearInterval(this.blinkId) + }; + this.showCursor = function() { + this.isVisible = true; + this.element.appendChild(this.cursor); + this.cursor.style.visibility = "visible"; + this.restartTimer() + }; + this.restartTimer = function() { + clearInterval(this.blinkId); + if(this.isVisible) { + var a = this.cursor; + this.blinkId = setInterval(function() { + a.style.visibility = "hidden"; + setTimeout(function() { + a.style.visibility = "visible" + }, 400) + }, 1E3) + } + }; + this.getPixelPosition = function() { + if(!this.config || !this.position) { + return{left:0, top:0} + }var a = this.position.row * this.config.lineHeight; + return{left:Math.round(this.position.column * this.config.characterWidth), top:a} + }; + this.update = function(a) { + if(this.position) { + this.config = a; + var b = Math.round(this.position.column * a.characterWidth), e = this.position.row * a.lineHeight; + this.pixelPos = {left:b, top:e}; + this.cursor.style.left = b + "px"; + this.cursor.style.top = e - a.firstRow * a.lineHeight + "px"; + this.cursor.style.width = a.characterWidth + "px"; + this.cursor.style.height = a.lineHeight + "px"; + this.isVisible && this.element.appendChild(this.cursor); + this.restartTimer() + } + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/layer/Gutter.js b/build/ace/layer/Gutter.js new file mode 100644 index 00000000..8848d2f9 --- /dev/null +++ b/build/ace/layer/Gutter.js @@ -0,0 +1,33 @@ +/* + LGPLv3 +*/ +require.def("ace/layer/Gutter", [], function() { + var d = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + a.appendChild(this.element); + this.$breakpoints = []; + this.$decorations = [] + }; + (function() { + this.addGutterDecoration = function(a, b) { + this.$decorations[a] || (this.$decorations[a] = ""); + this.$decorations[a] += " ace_" + b + }; + this.removeGutterDecoration = function(a, b) { + this.$decorations[a] = this.$decorations[a].replace(" ace_" + b, "") + }; + this.setBreakpoints = function(a) { + this.$breakpoints = a.concat() + }; + this.update = function(a) { + this.$config = a; + for(var b = [], c = a.firstRow;c <= a.lastRow;c++) { + b.push("", c + 1, ""); + b.push("") + }this.element.innerHTML = b.join(""); + this.element.style.height = a.minHeight + "px" + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/layer/Marker.js b/build/ace/layer/Marker.js new file mode 100644 index 00000000..35038256 --- /dev/null +++ b/build/ace/layer/Marker.js @@ -0,0 +1,74 @@ +/* + LGPLv3 +*/ +require.def("ace/layer/Marker", ["ace/Range"], function(h) { + var i = function(c) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + c.appendChild(this.element); + this.markers = {}; + this.$markerId = 1 + }; + (function() { + this.setDocument = function(c) { + this.doc = c + }; + this.addMarker = function(c, a, e) { + var b = this.$markerId++; + this.markers[b] = {range:c, type:e || "line", clazz:a}; + return b + }; + this.removeMarker = function(c) { + this.markers[c] && delete this.markers[c] + }; + this.update = function(c) { + if(c = c || this.config) { + this.config = c; + var a = []; + for(var e in this.markers) { + var b = this.markers[e], d = b.range.clipRows(c.firstRow, c.lastRow); + if(!d.isEmpty()) { + if(d.isMultiLine()) { + b.type == "text" ? this.drawTextMarker(a, d, b.clazz, c) : this.drawMultiLineMarker(a, d, b.clazz, c) + }else { + this.drawSingleLineMarker(a, d, b.clazz, c) + } + } + }this.element.innerHTML = a.join("") + } + }; + this.drawTextMarker = function(c, a, e, b) { + var d = a.start.row, f = new h(d, a.start.column, d, this.doc.getLine(d).length); + this.drawSingleLineMarker(c, f, e, b); + d = a.end.row; + f = new h(d, 0, d, a.end.column); + this.drawSingleLineMarker(c, f, e, b); + for(d = a.start.row + 1;d < a.end.row;d++) { + f.start.row = d; + f.end.row = d; + f.end.column = this.doc.getLine(d).length; + this.drawSingleLineMarker(c, f, e, b) + } + }; + this.drawMultiLineMarker = function(c, a, e, b) { + a = a.toScreenRange(this.doc); + var d = b.lineHeight, f = Math.round(b.width - a.start.column * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight, j = Math.round(a.start.column * b.characterWidth); + c.push(""); + g = (a.end.row - b.firstRow) * b.lineHeight; + f = Math.round(a.end.column * b.characterWidth); + c.push(""); + d = (a.end.row - a.start.row - 1) * b.lineHeight; + if(!(d < 0)) { + g = (a.start.row + 1 - b.firstRow) * b.lineHeight; + c.push("") + } + }; + this.drawSingleLineMarker = function(c, a, e, b) { + a = a.toScreenRange(this.doc); + var d = b.lineHeight, f = Math.round((a.end.column - a.start.column) * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight; + a = Math.round(a.start.column * b.characterWidth); + c.push("") + } + }).call(i.prototype); + return i +}); \ No newline at end of file diff --git a/build/ace/layer/Text.js b/build/ace/layer/Text.js new file mode 100644 index 00000000..a38df019 --- /dev/null +++ b/build/ace/layer/Text.js @@ -0,0 +1,158 @@ +/* + LGPLv3 +*/ +require.def("ace/layer/Text", ["ace/lib/oop", "ace/lib/dom", "ace/MEventEmitter"], function(m, n, o) { + var k = function(a) { + this.element = document.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + a.appendChild(this.element); + this.$characterSize = this.$measureSizes(); + this.$pollSizeChanges() + }; + (function() { + m.implement(this, o); + this.EOF_CHAR = "¶"; + this.EOL_CHAR = "¬"; + this.TAB_CHAR = "→"; + this.SPACE_CHAR = "·"; + this.setTokenizer = function(a) { + this.tokenizer = a + }; + this.getLineHeight = function() { + return this.$characterSize.height || 1 + }; + this.getCharacterWidth = function() { + return this.$characterSize.width || 1 + }; + this.$pollSizeChanges = function() { + var a = this; + setInterval(function() { + var b = a.$measureSizes(); + if(a.$characterSize.width !== b.width || a.$characterSize.height !== b.height) { + a.$characterSize = b; + a.$dispatchEvent("changeCharaterSize", {data:b}) + } + }, 500) + }; + this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1}; + this.$measureSizes = function() { + var a = document.createElement("div"), b = a.style; + b.width = b.height = "auto"; + b.left = b.top = "-1000px"; + b.visibility = "hidden"; + b.position = "absolute"; + b.overflow = "visible"; + for(var e in this.$fontStyles) { + var f = n.computedStyle(this.element, e); + b[e] = f + }a.innerHTML = (new Array(1E3)).join("Xy"); + document.body.insertBefore(a, document.body.firstChild); + b = {height:a.offsetHeight, width:a.offsetWidth / 2E3}; + document.body.removeChild(a); + return b + }; + this.setDocument = function(a) { + this.doc = a + }; + this.$showInvisibles = false; + this.setShowInvisibles = function(a) { + this.$showInvisibles = a + }; + this.$computeTabString = function() { + var a = this.doc.getTabSize(); + if(this.$showInvisibles) { + a = a / 2; + this.$tabString = "" + (new Array(Math.floor(a))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(a) + 1)).join(" ") + "" + }else { + this.$tabString = (new Array(a + 1)).join(" ") + } + }; + this.updateLines = function(a, b, e) { + this.$computeTabString(); + var f = Math.max(b, a.firstRow), c = Math.min(e, a.lastRow), d = this.element.childNodes, h = this; + this.tokenizer.getTokens(f, c, function(i) { + for(var g = f;g <= c;g++) { + var j = d[g - a.firstRow]; + if(j) { + var l = []; + h.$renderLine(l, g, i[g - f].tokens); + j.innerHTML = l.join("") + } + } + }) + }; + this.scrollLines = function(a) { + function b(i) { + a.firstRow < c.firstRow ? f.$renderLinesFragment(a, a.firstRow, c.firstRow - 1, function(g) { + d.firstChild ? d.insertBefore(g, d.firstChild) : d.appendChild(g); + i() + }) : i() + } + function e() { + a.lastRow > c.lastRow && f.$renderLinesFragment(a, c.lastRow + 1, a.lastRow, function(i) { + d.appendChild(i) + }) + } + var f = this; + this.$computeTabString(); + var c = this.config; + this.config = a; + if(!c || c.lastRow < a.firstRow) { + return this.update(a) + }if(a.lastRow < c.firstRow) { + return this.update(a) + }var d = this.element; + if(c.firstRow < a.firstRow) { + for(var h = c.firstRow;h < a.firstRow;h++) { + d.removeChild(d.firstChild) + } + }if(c.lastRow > a.lastRow) { + for(h = a.lastRow + 1;h <= c.lastRow;h++) { + d.removeChild(d.lastChild) + } + }b(e) + }; + this.$renderLinesFragment = function(a, b, e, f) { + var c = document.createDocumentFragment(), d = this; + this.tokenizer.getTokens(b, e, function(h) { + for(var i = b;i <= e;i++) { + var g = document.createElement("div"); + g.className = "ace_line"; + var j = g.style; + j.height = d.$characterSize.height + "px"; + j.width = a.width + "px"; + j = []; + d.$renderLine(j, i, h[i - b].tokens); + g.innerHTML = j.join(""); + c.appendChild(g) + }f(c) + }) + }; + this.update = function(a) { + this.$computeTabString(); + var b = [], e = this; + this.tokenizer.getTokens(a.firstRow, a.lastRow, function(f) { + for(var c = a.firstRow;c <= a.lastRow;c++) { + b.push(""); + e.$renderLine(b, c, f[c - a.firstRow].tokens); + b.push("") + }e.element.innerHTML = b.join("") + }) + }; + this.$textToken = {text:true, rparen:true, lparen:true}; + this.$renderLine = function(a, b, e) { + for(var f = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, c = 0;c < e.length;c++) { + var d = e[c], h = d.value.replace(/&/g, "&").replace(/", h, "") + } + }if(this.$showInvisibles) { + b !== this.doc.getLength() - 1 ? a.push("" + this.EOL_CHAR + "") : a.push("" + this.EOF_CHAR + "") + } + } + }).call(k.prototype); + return k +}); \ No newline at end of file diff --git a/build/ace/lib/core.js b/build/ace/lib/core.js new file mode 100644 index 00000000..de0d02e6 --- /dev/null +++ b/build/ace/lib/core.js @@ -0,0 +1,22 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/core", function() { + var a = {}, d = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); + a.isWin = d == "win"; + a.isMac = d == "mac"; + a.isLinux = d == "linux"; + a.isIE = !+"\u000b1"; + a.isGecko = window.controllers && window.navigator.product === "Gecko"; + a.provide = function(b) { + b = b.split("."); + for(var c = window, e = 0;e < b.length;e++) { + var f = b[e]; + c[f] || (c[f] = {}); + c = c[f] + } + }; + return a +}); \ No newline at end of file diff --git a/build/ace/lib/dom.js b/build/ace/lib/dom.js new file mode 100644 index 00000000..b8a6919f --- /dev/null +++ b/build/ace/lib/dom.js @@ -0,0 +1,70 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/dom", ["ace/lib/lang"], function(f) { + var c = {}; + c.setText = function(a, b) { + if(a.innerText !== undefined) { + a.innerText = b + }if(a.textContent !== undefined) { + a.textContent = b + } + }; + c.hasCssClass = function(a, b) { + a = a.className.split(/\s+/g); + return f.arrayIndexOf(a, b) !== -1 + }; + c.addCssClass = function(a, b) { + c.hasCssClass(a, b) || (a.className += " " + b) + }; + c.removeCssClass = function(a, b) { + for(var d = a.className.split(/\s+/g);;) { + var e = f.arrayIndexOf(d, b); + if(e == -1) { + break + }d.splice(e, 1) + }a.className = d.join(" ") + }; + c.importCssString = function(a, b) { + b = b || document; + if(b.createStyleSheet) { + b.createStyleSheet().cssText = a + }else { + var d = b.createElement("style"); + d.appendChild(b.createTextNode(a)); + b.getElementsByTagName("head")[0].appendChild(d) + } + }; + c.getInnerWidth = function(a) { + return parseInt(c.computedStyle(a, "paddingLeft")) + parseInt(c.computedStyle(a, "paddingRight")) + a.clientWidth + }; + c.getInnerHeight = function(a) { + return parseInt(c.computedStyle(a, "paddingTop")) + parseInt(c.computedStyle(a, "paddingBottom")) + a.clientHeight + }; + c.computedStyle = function(a, b) { + return window.getComputedStyle ? (window.getComputedStyle(a, "") || {})[b] || "" : a.currentStyle[b] + }; + c.scrollbarWidth = function() { + var a = document.createElement("p"); + a.style.width = "100%"; + a.style.height = "200px"; + var b = document.createElement("div"), d = b.style; + d.position = "absolute"; + d.left = "-10000px"; + d.overflow = "hidden"; + d.width = "200px"; + d.height = "150px"; + b.appendChild(a); + document.body.appendChild(b); + var e = a.offsetWidth; + d.overflow = "scroll"; + a = a.offsetWidth; + if(e == a) { + a = b.clientWidth + }document.body.removeChild(b); + return e - a + }; + return c +}); \ No newline at end of file diff --git a/build/ace/lib/event.js b/build/ace/lib/event.js new file mode 100644 index 00000000..d53e9a5d --- /dev/null +++ b/build/ace/lib/event.js @@ -0,0 +1,139 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/event", ["ace/lib/core"], function(i) { + var c = {}; + c.addListener = function(a, e, d) { + if(a.addEventListener) { + return a.addEventListener(e, d, false) + }if(a.attachEvent) { + var b = function() { + d(window.event) + }; + d.$$wrapper = b; + a.attachEvent("on" + e, b) + } + }; + c.removeListener = function(a, e, d) { + if(a.removeEventListener) { + return a.removeEventListener(e, d, false) + }if(a.detachEvent) { + a.detachEvent("on" + e, d.$$wrapper || d) + } + }; + c.stopEvent = function(a) { + c.stopPropagation(a); + c.preventDefault(a); + return false + }; + c.stopPropagation = function(a) { + if(a.stopPropagation) { + a.stopPropagation() + }else { + a.cancelBubble = true + } + }; + c.preventDefault = function(a) { + if(a.preventDefault) { + a.preventDefault() + }else { + a.returnValue = false + } + }; + c.getDocumentX = function(a) { + return a.clientX ? a.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : a.pageX + }; + c.getDocumentY = function(a) { + return a.clientY ? a.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : a.pageX + }; + c.getButton = function(a) { + return a.preventDefault ? a.button : Math.max(a.button - 1, 2) + }; + c.capture = document.documentElement.setCapture ? function(a, e, d) { + function b(h) { + e && e(h); + d && d(); + c.removeListener(a, "mousemove", e); + c.removeListener(a, "mouseup", b); + c.removeListener(a, "losecapture", b); + a.releaseCapture() + } + c.addListener(a, "mousemove", e); + c.addListener(a, "mouseup", b); + c.addListener(a, "losecapture", b); + a.setCapture() + } : function(a, e, d) { + function b(f) { + e(f); + f.stopPropagation() + } + function h(f) { + e && e(f); + d && d(); + document.removeEventListener("mousemove", b, true); + document.removeEventListener("mouseup", h, true); + f.stopPropagation() + } + document.addEventListener("mousemove", b, true); + document.addEventListener("mouseup", h, true) + }; + c.addMouseWheelListener = function(a, e) { + var d = function(b) { + if(b.wheelDelta !== undefined) { + if(b.wheelDeltaX !== undefined) { + b.wheelX = -b.wheelDeltaX / 8; + b.wheelY = -b.wheelDeltaY / 8 + }else { + b.wheelX = 0; + b.wheelY = -b.wheelDelta / 8 + } + }else { + if(b.axis && b.axis == b.HORIZONTAL_AXIS) { + b.wheelX = (b.detail || 0) * 5; + b.wheelY = 0 + }else { + b.wheelX = 0; + b.wheelY = (b.detail || 0) * 5 + } + }e(b) + }; + c.addListener(a, "DOMMouseScroll", d); + c.addListener(a, "mousewheel", d) + }; + c.addMultiMouseDownListener = function(a, e, d, b, h) { + var f = 0, j, k, l = function(g) { + f += 1; + if(f == 1) { + j = g.clientX; + k = g.clientY; + setTimeout(function() { + f = 0 + }, b || 600) + }if(c.getButton(g) != e || Math.abs(g.clientX - j) > 5 || Math.abs(g.clientY - k) > 5) { + f = 0 + }if(f == d) { + f = 0; + h(g) + }return c.preventDefault(g) + }; + c.addListener(a, "mousedown", l); + i.isIE && c.addListener(a, "dblclick", l) + }; + c.addKeyListener = function(a, e) { + var d = null; + c.addListener(a, "keydown", function(b) { + d = b.keyIdentifier || b.keyCode; + return e(b) + }); + i.isMac && i.isGecko && c.addListener(a, "keypress", function(b) { + if(d !== (b.keyIdentifier || b.keyCode)) { + return e(b) + }else { + d = null + } + }) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/lib/lang.js b/build/ace/lib/lang.js new file mode 100644 index 00000000..186c175d --- /dev/null +++ b/build/ace/lib/lang.js @@ -0,0 +1,61 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/lang", function() { + var d = {}; + d.stringReverse = function(a) { + return a.split("").reverse().join("") + }; + d.stringRepeat = function(a, b) { + return(new Array(b + 1)).join(a) + }; + d.arrayIndexOf = Array.prototype.indexOf ? function(a, b) { + return a.indexOf(b) + } : function(a, b) { + for(var c = 0;c < a.length;c++) { + if(a[c] == b) { + return c + } + }return-1 + }; + d.isArray = function(a) { + return Object.prototype.toString.call(a) == "[object Array]" + }; + d.copyObject = function(a) { + var b = {}; + for(var c in a) { + b[c] = a[c] + }return b + }; + d.arrayToMap = function(a) { + for(var b = {}, c = 0;c < a.length;c++) { + b[a[c]] = 1 + }return b + }; + d.escapeRegExp = function(a) { + return a.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1") + }; + d.bind = function(a, b) { + return function() { + return a.apply(b, arguments) + } + }; + d.deferredCall = function(a) { + var b = null, c = function() { + b = null; + a() + }; + return{schedule:function() { + b || (b = setTimeout(c, 0)) + }, call:function() { + d.cancel(); + a() + }, cancel:function() { + clearTimeout(b); + b = null + }} + }; + return d +}); \ No newline at end of file diff --git a/build/ace/lib/oop.js b/build/ace/lib/oop.js new file mode 100644 index 00000000..6bb3fd09 --- /dev/null +++ b/build/ace/lib/oop.js @@ -0,0 +1,25 @@ +/* + LGPLv3 +*/ +if(!require.def) { + require.def = require("requireJS-node")(module, require) +}require.def("ace/lib/oop", function() { + var c = {}; + c.inherits = function(a, b) { + var d = function() { + }; + d.prototype = b.prototype; + a.super_ = b.prototype; + a.prototype = new d; + a.prototype.constructor = a + }; + c.mixin = function(a, b) { + for(var d in b) { + a[d] = b[d] + } + }; + c.implement = function(a, b) { + c.mixin(a, b) + }; + return c +}); \ No newline at end of file diff --git a/build/ace/mode/Css.js b/build/ace/mode/Css.js new file mode 100644 index 00000000..dadcb7eb --- /dev/null +++ b/build/ace/mode/Css.js @@ -0,0 +1,81 @@ +/* + LGPLv3 + LGPLv3 + LGPLv3 +*/ +require.def("ace/mode/CssHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/TextHighlightRules"], function(j, f, b) { + var e = function() { + function a(c) { + var l = []; + c = c.split(""); + for(var k = 0;k < c.length;k++) { + l.push("[", c[k].toLowerCase(), c[k].toUpperCase(), "]") + }return l.join("") + } + var d = f.arrayToMap("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|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("|")), + g = f.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), h = f.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|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("|")), + i = f.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"}, + {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(c) { + return d[c.toLowerCase()] ? "support.type" : g[c.toLowerCase()] ? "support.function" : h[c.toLowerCase()] ? "support.constant" : i[c.toLowerCase()] ? "support.constant.color" : "text" + }, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]} + }; + j.inherits(e, b); + return e +}); +require.def("ace/mode/MatchingBraceOutdent", ["ace/Range"], function(j) { + var f = function() { + }; + (function() { + this.checkOutdent = function(b, e) { + if(!/^\s+$/.test(b)) { + return false + }return/^\s*\}/.test(e) + }; + this.autoOutdent = function(b, e) { + var a = b.getLine(e).match(/^(\s*\})/); + if(!a) { + return 0 + }a = a[1].length; + var d = b.findMatchingBracket({row:e, column:a}); + if(!d || d.row == e) { + return 0 + }d = this.$getIndent(b.getLine(d.row)); + b.replace(new j(e, 0, e, a - 1), d); + return d.length - (a - 1) + }; + this.$getIndent = function(b) { + if(b = b.match(/^(\s+)/)) { + return b[1] + }return"" + } + }).call(f.prototype); + return f +}); +require.def("ace/mode/Css", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/CssHighlightRules", "ace/mode/MatchingBraceOutdent"], function(j, f, b, e, a) { + var d = function() { + this.$tokenizer = new b((new e).getRules()); + this.$outdent = new a + }; + j.inherits(d, f); + (function() { + this.getNextLineIndent = function(g, h, i) { + var c = this.$getIndent(h); + g = this.$tokenizer.getLineTokens(h, g).tokens; + if(g.length && g[g.length - 1].type == "comment") { + return c + }if(h.match(/^.*\{\s*$/)) { + c += i + }return c + }; + this.checkOutdent = function(g, h, i) { + return this.$outdent.checkOutdent(h, i) + }; + this.autoOutdent = function(g, h, i) { + return this.$outdent.autoOutdent(h, i) + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/mode/CssHighlightRules.js b/build/ace/mode/CssHighlightRules.js new file mode 100644 index 00000000..1773ce2a --- /dev/null +++ b/build/ace/mode/CssHighlightRules.js @@ -0,0 +1,25 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/CssHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/TextHighlightRules"], function(g, c, h) { + var f = function() { + function a(b) { + var e = []; + b = b.split(""); + for(var d = 0;d < b.length;d++) { + e.push("[", b[d].toLowerCase(), b[d].toUpperCase(), "]") + }return e.join("") + } + var i = c.arrayToMap("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|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("|")), + j = c.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), k = c.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|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("|")), + l = c.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + + a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"}, + {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(b) { + return i[b.toLowerCase()] ? "support.type" : j[b.toLowerCase()] ? "support.function" : k[b.toLowerCase()] ? "support.constant" : l[b.toLowerCase()] ? "support.constant.color" : "text" + }, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]} + }; + g.inherits(f, h); + return f +}); \ No newline at end of file diff --git a/build/ace/mode/DocCommentHighlightRules.js b/build/ace/mode/DocCommentHighlightRules.js new file mode 100644 index 00000000..f85873bb --- /dev/null +++ b/build/ace/mode/DocCommentHighlightRules.js @@ -0,0 +1,15 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/DocCommentHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) { + var a = function() { + this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]} + }; + b.inherits(a, c); + (function() { + this.getStartRule = function(d) { + return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:d} + } + }).call(a.prototype); + return a +}); \ No newline at end of file diff --git a/build/ace/mode/Html.js b/build/ace/mode/Html.js new file mode 100644 index 00000000..5c75edf2 --- /dev/null +++ b/build/ace/mode/Html.js @@ -0,0 +1,58 @@ +/* + LGPLv3 + LGPLv3 +*/ +require.def("ace/mode/HtmlHighlightRules", ["ace/lib/oop", "ace/mode/CssHighlightRules", "ace/mode/JavaScriptHighlightRules", "ace/mode/TextHighlightRules"], function(e, f, g, h) { + var c = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, + {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"}, + {token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}; + this.addRules((new g).getRules(), "js-"); + this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"}); + this.addRules((new f).getRules(), "css-"); + this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"}) + }; + e.inherits(c, h); + return c +}); +require.def("ace/mode/Html", ["ace/lib/oop", "ace/mode/Text", "ace/mode/JavaScript", "ace/mode/Css", "ace/Tokenizer", "ace/mode/HtmlHighlightRules"], function(e, f, g, h, c, l) { + var i = function() { + this.$tokenizer = new c((new l).getRules()); + this.$js = new g; + this.$css = new h + }; + e.inherits(i, f); + (function() { + this.toggleCommentLines = function() { + return this.$delegate("toggleCommentLines", arguments, function() { + return 0 + }) + }; + this.getNextLineIndent = function(j, a) { + var d = this; + return this.$delegate("getNextLineIndent", arguments, function() { + return d.$getIndent(a) + }) + }; + this.checkOutdent = function() { + return this.$delegate("checkOutdent", arguments, function() { + return false + }) + }; + this.autoOutdent = function() { + return this.$delegate("autoOutdent", arguments) + }; + this.$delegate = function(j, a, d) { + var k = a[0], b = k.split("js-"); + if(!b[0] && b[1]) { + a[0] = b[1]; + return this.$js[j].apply(this.$js, a) + }b = k.split("css-"); + if(!b[0] && b[1]) { + a[0] = b[1]; + return this.$css[j].apply(this.$css, a) + }return d ? d() : undefined + } + }).call(i.prototype); + return i +}); \ No newline at end of file diff --git a/build/ace/mode/HtmlHighlightRules.js b/build/ace/mode/HtmlHighlightRules.js new file mode 100644 index 00000000..b3257846 --- /dev/null +++ b/build/ace/mode/HtmlHighlightRules.js @@ -0,0 +1,16 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/HtmlHighlightRules", ["ace/lib/oop", "ace/mode/CssHighlightRules", "ace/mode/JavaScriptHighlightRules", "ace/mode/TextHighlightRules"], function(b, c, d, e) { + var a = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, + {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"}, + {token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}; + this.addRules((new d).getRules(), "js-"); + this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"}); + this.addRules((new c).getRules(), "css-"); + this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"}) + }; + b.inherits(a, e); + return a +}); \ No newline at end of file diff --git a/build/ace/mode/JavaScript.js b/build/ace/mode/JavaScript.js new file mode 100644 index 00000000..a4bceb82 --- /dev/null +++ b/build/ace/mode/JavaScript.js @@ -0,0 +1,61 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/JavaScript", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/JavaScriptHighlightRules", "ace/mode/MatchingBraceOutdent", "ace/Range"], function(h, i, j, k, l, m) { + var g = function() { + this.$tokenizer = new j((new k).getRules()); + this.$outdent = new l + }; + h.inherits(g, i); + (function() { + this.toggleCommentLines = function(d, b, e) { + var c = true; + d = /^(\s*)\/\//; + for(var a = e.start.row;a <= e.end.row;a++) { + if(!d.test(b.getLine(a))) { + c = false; + break + } + }if(c) { + c = new m(0, 0, 0, 0); + for(a = e.start.row;a <= e.end.row;a++) { + var f = b.getLine(a).replace(d, "$1"); + c.start.row = a; + c.end.row = a; + c.end.column = f.length + 2; + b.replace(c, f) + }return-2 + }else { + return b.indentRows(e, "//") + } + }; + this.getNextLineIndent = function(d, b, e) { + var c = this.$getIndent(b), a = this.$tokenizer.getLineTokens(b, d), f = a.tokens; + a = a.state; + if(f.length && f[f.length - 1].type == "comment") { + return c + }if(d == "start") { + if(d = b.match(/^.*[\{\(\[]\s*$/)) { + c += e + } + }else { + if(d == "doc-start") { + if(a == "start") { + return"" + }if(d = b.match(/^\s*(\/?)\*/)) { + if(d[1]) { + c += " " + }c += "* " + } + } + }return c + }; + this.checkOutdent = function(d, b, e) { + return this.$outdent.checkOutdent(b, e) + }; + this.autoOutdent = function(d, b, e) { + return this.$outdent.autoOutdent(b, e) + } + }).call(g.prototype); + return g +}); \ No newline at end of file diff --git a/build/ace/mode/JavaScriptHighlightRules.js b/build/ace/mode/JavaScriptHighlightRules.js new file mode 100644 index 00000000..18ae6f17 --- /dev/null +++ b/build/ace/mode/JavaScriptHighlightRules.js @@ -0,0 +1,17 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/JavaScriptHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/DocCommentHighlightRules", "ace/mode/TextHighlightRules"], function(d, b, e, f) { + JavaScriptHighlightRules = function() { + var c = new e, g = b.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), h = b.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), i = b.arrayToMap("abstract|boolean|byte|char|class|const|enum|export|extends|final|float|goto|implements|int|interface|long|native|package|private|protected|short|static|super|synchronized|throws|transient|volatiledouble|import|public".split("|")); + this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, c.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric", + regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:function(a) { + return a == "this" ? "variable.language" : g[a] ? "keyword" : h[a] ? "constant.language" : i[a] ? "invalid.illegal" : a == "debugger" ? "invalid.deprecated" : "identifier" + }, regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"}, {token:"keyword.operator", regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(in|instanceof|new|delete|typeof|void)"}, {token:"lparen", regex:"[\\[\\(\\{]"}, {token:"rparen", regex:"[\\]\\)\\}]"}, {token:"text", regex:"\\s+"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"', + next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]}; + this.addRules(c.getRules(), "doc-"); + this.$rules["doc-start"][0].next = "start" + }; + d.inherits(JavaScriptHighlightRules, f); + return JavaScriptHighlightRules +}); \ No newline at end of file diff --git a/build/ace/mode/MatchingBraceOutdent.js b/build/ace/mode/MatchingBraceOutdent.js new file mode 100644 index 00000000..d2cc35e5 --- /dev/null +++ b/build/ace/mode/MatchingBraceOutdent.js @@ -0,0 +1,32 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/MatchingBraceOutdent", ["ace/Range"], function(f) { + var e = function() { + }; + (function() { + this.checkOutdent = function(a, b) { + if(!/^\s+$/.test(a)) { + return false + }return/^\s*\}/.test(b) + }; + this.autoOutdent = function(a, b) { + var c = a.getLine(b).match(/^(\s*\})/); + if(!c) { + return 0 + }c = c[1].length; + var d = a.findMatchingBracket({row:b, column:c}); + if(!d || d.row == b) { + return 0 + }d = this.$getIndent(a.getLine(d.row)); + a.replace(new f(b, 0, b, c - 1), d); + return d.length - (c - 1) + }; + this.$getIndent = function(a) { + if(a = a.match(/^(\s+)/)) { + return a[1] + }return"" + } + }).call(e.prototype); + return e +}); \ No newline at end of file diff --git a/build/ace/mode/Text.js b/build/ace/mode/Text.js new file mode 100644 index 00000000..0a665da4 --- /dev/null +++ b/build/ace/mode/Text.js @@ -0,0 +1,30 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/Text", ["ace/Tokenizer", "ace/mode/TextHighlightRules"], function(c, d) { + var b = function() { + this.$tokenizer = new c((new d).getRules()) + }; + (function() { + this.getTokenizer = function() { + return this.$tokenizer + }; + this.toggleCommentLines = function() { + return 0 + }; + this.getNextLineIndent = function() { + return"" + }; + this.checkOutdent = function() { + return false + }; + this.autoOutdent = function() { + }; + this.$getIndent = function(a) { + if(a = a.match(/^(\s+)/)) { + return a[1] + }return"" + } + }).call(b.prototype); + return b +}); \ No newline at end of file diff --git a/build/ace/mode/TextHighlightRules.js b/build/ace/mode/TextHighlightRules.js new file mode 100644 index 00000000..31d047c9 --- /dev/null +++ b/build/ace/mode/TextHighlightRules.js @@ -0,0 +1,22 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/TextHighlightRules", [], function() { + var f = function() { + this.$rules = {start:[{token:"text", regex:".+"}]} + }; + (function() { + this.addRules = function(g, a) { + for(var b in g) { + for(var c = g[b], d = 0;d < c.length;d++) { + var e = c[d]; + e.next = e.next ? a + e.next : a + b + }this.$rules[a + b] = c + } + }; + this.getRules = function() { + return this.$rules + } + }).call(f.prototype); + return f +}); \ No newline at end of file diff --git a/build/ace/mode/Xml.js b/build/ace/mode/Xml.js new file mode 100644 index 00000000..d56249da --- /dev/null +++ b/build/ace/mode/Xml.js @@ -0,0 +1,24 @@ +/* + LGPLv3 + LGPLv3 +*/ +require.def("ace/mode/XmlHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) { + var a = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", + next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]} + }; + b.inherits(a, c); + return a +}); +require.def("ace/mode/Xml", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/XmlHighlightRules"], function(b, c, a, e) { + var d = function() { + this.$tokenizer = new a((new e).getRules()) + }; + b.inherits(d, c); + (function() { + this.getNextLineIndent = function(g, f) { + return this.$getIndent(f) + } + }).call(d.prototype); + return d +}); \ No newline at end of file diff --git a/build/ace/mode/XmlHighlightRules.js b/build/ace/mode/XmlHighlightRules.js new file mode 100644 index 00000000..8969598a --- /dev/null +++ b/build/ace/mode/XmlHighlightRules.js @@ -0,0 +1,11 @@ +/* + LGPLv3 +*/ +require.def("ace/mode/XmlHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) { + var a = function() { + this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", + next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]} + }; + b.inherits(a, c); + return a +}); \ No newline at end of file diff --git a/build/ace/test/ChangeDocumentTest.js b/build/ace/test/ChangeDocumentTest.js new file mode 100644 index 00000000..afd3d113 --- /dev/null +++ b/build/ace/test/ChangeDocumentTest.js @@ -0,0 +1,79 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Editor", "ace/mode/Text", "ace/mode/JavaScript", "ace/test/MockRenderer"], function(b, c, f, d, e) { + new TestCase("ChangeDocumentTest", {setUp:function() { + this.doc1 = new b("abc\ndef"); + this.doc2 = new b("ghi\njkl"); + this.editor = new c(new e) + }, "test: change document":function() { + this.editor.setDocument(this.doc1); + assertEquals(this.doc1, this.editor.getDocument()); + this.editor.setDocument(this.doc2); + assertEquals(this.doc2, this.editor.getDocument()) + }, "test: only changes to the new document should have effect":function() { + var a = false; + this.editor.onDocumentChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + this.doc1.duplicateLines(0, 0); + assertFalse(a); + this.doc2.duplicateLines(0, 0); + assertTrue(a) + }, "test: should use cursor of new document":function() { + this.doc1.getSelection().moveCursorTo(0, 1); + this.doc2.getSelection().moveCursorTo(1, 0); + this.editor.setDocument(this.doc1); + assertPosition(0, 1, this.editor.getCursorPosition()); + this.editor.setDocument(this.doc2); + assertPosition(1, 0, this.editor.getCursorPosition()) + }, "test: only changing the cursor of the new doc should not have an effect":function() { + this.editor.onCursorChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + assertPosition(0, 0, this.editor.getCursorPosition()); + var a = false; + this.doc1.getSelection().moveCursorTo(0, 1); + assertPosition(0, 0, this.editor.getCursorPosition()); + assertFalse(a); + this.doc2.getSelection().moveCursorTo(1, 1); + assertPosition(1, 1, this.editor.getCursorPosition()); + assertTrue(a) + }, "test: should use selection of new document":function() { + this.doc1.getSelection().selectTo(0, 1); + this.doc2.getSelection().selectTo(1, 0); + this.editor.setDocument(this.doc1); + assertPosition(0, 1, this.editor.getSelection().getSelectionLead()); + this.editor.setDocument(this.doc2); + assertPosition(1, 0, this.editor.getSelection().getSelectionLead()) + }, "test: only changing the selection of the new doc should not have an effect":function() { + this.editor.onSelectionChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + assertPosition(0, 0, this.editor.getSelection().getSelectionLead()); + var a = false; + this.doc1.getSelection().selectTo(0, 1); + assertPosition(0, 0, this.editor.getSelection().getSelectionLead()); + assertFalse(a); + this.doc2.getSelection().selectTo(1, 1); + assertPosition(1, 1, this.editor.getSelection().getSelectionLead()); + assertTrue(a) + }, "test: should use mode of new document":function() { + this.editor.onDocumentModeChange = function() { + a = true + }; + this.editor.setDocument(this.doc1); + this.editor.setDocument(this.doc2); + var a = false; + this.doc1.setMode(new Text); + assertFalse(a); + this.doc2.setMode(new d); + assertTrue(a) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/DocumentTest.js b/build/ace/test/DocumentTest.js new file mode 100644 index 00000000..c9e44b04 --- /dev/null +++ b/build/ace/test/DocumentTest.js @@ -0,0 +1,148 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/UndoManager", "ace/Editor", "ace/test/MockRenderer"], function(b, h, i, j) { + new TestCase("TextDocumentTest", {"test: find matching opening bracket":function() { + var a = new b(["(()(", "())))"]); + assertPosition(0, 1, a.findMatchingBracket({row:0, column:3})); + assertPosition(1, 0, a.findMatchingBracket({row:1, column:2})); + assertPosition(0, 3, a.findMatchingBracket({row:1, column:3})); + assertPosition(0, 0, a.findMatchingBracket({row:1, column:4})); + assertEquals(null, a.findMatchingBracket({row:1, column:5})) + }, "test: find matching closing bracket":function() { + var a = new b(["(()(", "())))"]); + assertPosition(1, 1, a.findMatchingBracket({row:1, column:1})); + assertPosition(1, 1, a.findMatchingBracket({row:1, column:1})); + assertPosition(1, 2, a.findMatchingBracket({row:0, column:4})); + assertPosition(0, 2, a.findMatchingBracket({row:0, column:2})); + assertPosition(1, 3, a.findMatchingBracket({row:0, column:1})); + assertEquals(null, a.findMatchingBracket({row:0, column:0})) + }, "test: match different bracket types":function() { + var a = new b(["({[", ")]}"]); + assertPosition(1, 0, a.findMatchingBracket({row:0, column:1})); + assertPosition(1, 2, a.findMatchingBracket({row:0, column:2})); + assertPosition(1, 1, a.findMatchingBracket({row:0, column:3})); + assertPosition(0, 0, a.findMatchingBracket({row:1, column:1})); + assertPosition(0, 2, a.findMatchingBracket({row:1, column:2})); + assertPosition(0, 1, a.findMatchingBracket({row:1, column:3})) + }, "test: move lines down":function() { + var a = new b(["1", "2", "3", "4"]); + a.moveLinesDown(0, 1); + assertEquals("3\n1\n2\n4", a.toString()); + a.moveLinesDown(1, 2); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesDown(2, 3); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesDown(2, 2); + assertEquals("3\n4\n2\n1", a.toString()) + }, "test: move lines up":function() { + var a = new b(["1", "2", "3", "4"]); + a.moveLinesUp(2, 3); + assertEquals("1\n3\n4\n2", a.toString()); + a.moveLinesUp(1, 2); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesUp(0, 1); + assertEquals("3\n4\n1\n2", a.toString()); + a.moveLinesUp(2, 2); + assertEquals("3\n1\n4\n2", a.toString()) + }, "test: duplicate lines":function() { + var a = new b(["1", "2", "3", "4"]); + a.duplicateLines(1, 2); + assertEquals("1\n2\n3\n2\n3\n4", a.toString()) + }, "test: duplicate last line":function() { + var a = new b(["1", "2", "3"]); + a.duplicateLines(2, 2); + assertEquals("1\n2\n3\n3", a.toString()) + }, "test: duplicate first line":function() { + var a = new b(["1", "2", "3"]); + a.duplicateLines(0, 0); + assertEquals("1\n1\n2\n3", a.toString()) + }, "test: should handle unix style new lines":function() { + var a = new b(["1", "2", "3"]); + assertEquals("1\n2\n3", a.toString()) + }, "test: should handle windows style new lines":function() { + var a = new b("1\r\n2\r\n3"); + a.setNewLineMode("unix"); + assertEquals("1\n2\n3", a.toString()) + }, "test: set new line mode to 'windows' should use '\r\n' as new lines":function() { + var a = new b("1\n2\n3"); + a.setNewLineMode("windows"); + assertEquals("1\r\n2\r\n3", a.toString()) + }, "test: set new line mode to 'unix' should use '\n' as new lines":function() { + var a = new b("1\r\n2\r\n3"); + a.setNewLineMode("unix"); + assertEquals("1\n2\n3", a.toString()) + }, "test: set new line mode to 'auto' should use detect the incoming nl type":function() { + var a = new b("1\n2\n3"); + a.setNewLineMode("auto"); + assertEquals("1\n2\n3", a.toString()); + a = new b("1\r\n2\r\n3"); + a.setNewLineMode("auto"); + assertEquals("1\r\n2\r\n3", a.toString()); + a.replace(new Range(0, 0, 2, 1), "4\n5\n6"); + assertEquals("4\n5\n6", a.toString()) + }, "test: undo/redo for delete line":function() { + var a = new b(["111", "222", "333"]), c = new h; + a.setUndoManager(c); + var e = a.toString(), d = new i(new j, a); + d.removeLines(); + var f = a.toString(); + assertEquals("222\n333", f); + a.$informUndoManager.call(); + d.removeLines(); + var g = a.toString(); + assertEquals("333", g); + a.$informUndoManager.call(); + d.removeLines(); + d = a.toString(); + assertEquals("", d); + a.$informUndoManager.call(); + c.undo(); + a.$informUndoManager.call(); + assertEquals(g, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(f, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(e, a.toString()); + c.undo(); + a.$informUndoManager.call(); + assertEquals(e, a.toString()) + }, "test: convert document to screen coordinates":function() { + var a = new b("01234\t567890\t1234"); + a.setTabSize(4); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 4)); + assertEquals(5, a.documentToScreenColumn(0, 5)); + assertEquals(9, a.documentToScreenColumn(0, 6)); + assertEquals(15, a.documentToScreenColumn(0, 12)); + assertEquals(19, a.documentToScreenColumn(0, 13)); + a.setTabSize(2); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 4)); + assertEquals(5, a.documentToScreenColumn(0, 5)); + assertEquals(7, a.documentToScreenColumn(0, 6)); + assertEquals(13, a.documentToScreenColumn(0, 12)); + assertEquals(15, a.documentToScreenColumn(0, 13)) + }, "test: convert document to scrren coordinates with leading tabs":function() { + var a = new b("\t\t123"); + a.setTabSize(4); + assertEquals(0, a.documentToScreenColumn(0, 0)); + assertEquals(4, a.documentToScreenColumn(0, 1)); + assertEquals(8, a.documentToScreenColumn(0, 2)); + assertEquals(9, a.documentToScreenColumn(0, 3)) + }, "test: convert screen to document coordinates":function() { + var a = new b("01234\t567890\t1234"); + a.setTabSize(4); + assertEquals(0, a.screenToDocumentColumn(0, 0)); + assertEquals(4, a.screenToDocumentColumn(0, 4)); + assertEquals(5, a.screenToDocumentColumn(0, 5)); + assertEquals(5, a.screenToDocumentColumn(0, 6)); + assertEquals(5, a.screenToDocumentColumn(0, 7)); + assertEquals(5, a.screenToDocumentColumn(0, 8)); + assertEquals(6, a.screenToDocumentColumn(0, 9)); + assertEquals(12, a.screenToDocumentColumn(0, 15)); + assertEquals(13, a.screenToDocumentColumn(0, 19)) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/EventEmitterTest.js b/build/ace/test/EventEmitterTest.js new file mode 100644 index 00000000..5b91cdfa --- /dev/null +++ b/build/ace/test/EventEmitterTest.js @@ -0,0 +1,17 @@ +/* + LGPLv3 +*/ +require.def(["ace/lib/oop", "ace/MEventEmitter"], function(d, e) { + var a = function() { + }; + d.implement(a.prototype, e); + new TestCase("EventEmitterTest", {"test: dispatch event with no data":function() { + var b = new a, c = false; + b.addEventListener("juhu", function(f) { + c = true; + assertEquals("juhu", f.type) + }); + b.$dispatchEvent("juhu"); + assertTrue(c) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/MockRenderer.js b/build/ace/test/MockRenderer.js new file mode 100644 index 00000000..80df09eb --- /dev/null +++ b/build/ace/test/MockRenderer.js @@ -0,0 +1,56 @@ +/* + LGPLv3 +*/ +require.def([], function() { + MockRenderer = function(a) { + this.container = document.createElement("div"); + this.cursor = {row:0, column:0}; + this.visibleRowCount = a || 20; + this.layerConfig = {firstVisibleRow:0, lastVisibleRow:this.visibleRowCount} + }; + MockRenderer.prototype.getFirstVisibleRow = function() { + return this.layerConfig.firstVisibleRow + }; + MockRenderer.prototype.getLastVisibleRow = function() { + return this.layerConfig.lastVisibleRow + }; + MockRenderer.prototype.getContainerElement = function() { + return this.container + }; + MockRenderer.prototype.getMouseEventTarget = function() { + return this.container + }; + MockRenderer.prototype.setDocument = function(a) { + this.lines = a.lines + }; + MockRenderer.prototype.setTokenizer = function() { + }; + MockRenderer.prototype.updateCursor = function(a) { + this.cursor.row = a.row; + this.cursor.column = a.column + }; + MockRenderer.prototype.scrollCursorIntoView = function() { + if(this.cursor.row < this.layerConfig.firstVisibleRow) { + this.scrollToRow(this.cursor.row) + }else { + this.cursor.row > this.layerConfig.lastVisibleRow && this.scrollToRow(this.cursor.row) + } + }; + MockRenderer.prototype.scrollToRow = function(a) { + a = Math.min(this.lines.length - this.visibleRowCount, Math.max(0, a)); + this.layerConfig.firstVisibleRow = a; + this.layerConfig.lastVisibleRow = a + this.visibleRowCount + }; + MockRenderer.prototype.getScrollTopRow = function() { + return this.layerConfig.firstVisibleRow + }; + MockRenderer.prototype.draw = function() { + }; + MockRenderer.prototype.updateLines = function() { + }; + MockRenderer.prototype.addMarker = function() { + }; + MockRenderer.prototype.setBreakpoints = function() { + }; + return MockRenderer +}); \ No newline at end of file diff --git a/build/ace/test/NavigationTest.js b/build/ace/test/NavigationTest.js new file mode 100644 index 00000000..7a33ea4d --- /dev/null +++ b/build/ace/test/NavigationTest.js @@ -0,0 +1,77 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Editor", "ace/test/MockRenderer"], function(e, c, d) { + TestCase("NavigationTest", {createTextDocument:function(a, b) { + b = (new Array(b + 1)).join("a"); + a = (new Array(a)).join(b + "\n") + b; + return new e(a) + }, "test: navigate to end of file should scroll the last line into view":function() { + var a = this.createTextDocument(200, 10); + a = new c(new d, a); + a.navigateFileEnd(); + var b = a.getCursorPosition(); + assertTrue(a.getFirstVisibleRow() <= b.row); + assertTrue(a.getLastVisibleRow() >= b.row) + }, "test: navigate to start of file should scroll the first row into view":function() { + var a = this.createTextDocument(200, 10); + a = new c(new d, a); + a.moveCursorTo(a.getLastVisibleRow() + 20); + a.navigateFileStart(); + assertEquals(0, a.getFirstVisibleRow()) + }, "test: goto hidden line should scroll the line into the middle of the viewport":function() { + var a = new c(new d, this.createTextDocument(200, 5)); + a.navigateTo(0, 0); + a.gotoLine(101); + assertPosition(100, 0, a.getCursorPosition()); + assertEquals(90, a.getFirstVisibleRow()); + a.navigateTo(100, 0); + a.gotoLine(11); + assertPosition(10, 0, a.getCursorPosition()); + assertEquals(0, a.getFirstVisibleRow()); + a.navigateTo(100, 0); + a.gotoLine(6); + assertPosition(5, 0, a.getCursorPosition()); + assertEquals(0, a.getFirstVisibleRow()); + a.navigateTo(100, 0); + a.gotoLine(1); + assertPosition(0, 0, a.getCursorPosition()); + assertEquals(0, a.getFirstVisibleRow()); + a.navigateTo(0, 0); + a.gotoLine(191); + assertPosition(190, 0, a.getCursorPosition()); + assertEquals(180, a.getFirstVisibleRow()); + a.navigateTo(0, 0); + a.gotoLine(196); + assertPosition(195, 0, a.getCursorPosition()); + assertEquals(180, a.getFirstVisibleRow()) + }, "test: goto visible line should only move the cursor and not scroll":function() { + var a = new c(new d, this.createTextDocument(200, 5)); + a.navigateTo(0, 0); + a.gotoLine(12); + assertPosition(11, 0, a.getCursorPosition()); + assertEquals(0, a.getFirstVisibleRow()); + a.navigateTo(30, 0); + a.gotoLine(33); + assertPosition(32, 0, a.getCursorPosition()); + assertEquals(30, a.getFirstVisibleRow()) + }, "test: navigate from the end of a long line down to a short line and back should maintain the curser column":function() { + var a = new c(new d, new e(["123456", "1"])); + a.navigateTo(0, 6); + assertPosition(0, 6, a.getCursorPosition()); + a.navigateDown(); + assertPosition(1, 1, a.getCursorPosition()); + a.navigateUp(); + assertPosition(0, 6, a.getCursorPosition()) + }, "test: reset desired column on navigate left or right":function() { + var a = new c(new d, new e(["123456", "12"])); + a.navigateTo(0, 6); + assertPosition(0, 6, a.getCursorPosition()); + a.navigateDown(); + assertPosition(1, 2, a.getCursorPosition()); + a.navigateLeft(); + assertPosition(1, 1, a.getCursorPosition()); + a.navigateUp(); + assertPosition(0, 1, a.getCursorPosition()) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/RangeTest.js b/build/ace/test/RangeTest.js new file mode 100644 index 00000000..56243724 --- /dev/null +++ b/build/ace/test/RangeTest.js @@ -0,0 +1,74 @@ +/* + LGPLv3 +*/ +require.def(["ace/Range"], function(b) { + RangeTest = new TestCase("RangeTest", {"test: create range":function() { + var a = new b(1, 2, 3, 4); + assertEquals(1, a.start.row); + assertEquals(2, a.start.column); + assertEquals(3, a.end.row); + assertEquals(4, a.end.column) + }, "test: create from points":function() { + var a = b.fromPoints({row:1, column:2}, {row:3, column:4}); + assertEquals(1, a.start.row); + assertEquals(2, a.start.column); + assertEquals(3, a.end.row); + assertEquals(4, a.end.column) + }, "test: clip to rows":function() { + assertRange(10, 0, 31, 0, (new b(0, 20, 100, 30)).clipRows(10, 30)); + assertRange(10, 0, 30, 10, (new b(0, 20, 30, 10)).clipRows(10, 30)); + var a = new b(0, 20, 3, 10); + a = a.clipRows(10, 30); + assertTrue(a.isEmpty()); + assertRange(10, 0, 10, 0, a) + }, "test: isEmpty":function() { + var a = new b(1, 2, 1, 2); + assertTrue(a.isEmpty()); + a = new b(1, 2, 1, 6); + assertFalse(a.isEmpty()) + }, "test: is multi line":function() { + var a = new b(1, 2, 1, 6); + assertFalse(a.isMultiLine()); + a = new b(1, 2, 2, 6); + assertTrue(a.isMultiLine()) + }, "test: clone":function() { + var a = new b(1, 2, 3, 4), c = a.clone(); + assertPosition(1, 2, c.start); + assertPosition(3, 4, c.end); + c.start.column = 20; + assertPosition(1, 2, a.start); + c.end.column = 20; + assertPosition(3, 4, a.end) + }, "test: contains for multi line ranges":function() { + var a = new b(1, 10, 5, 20); + assertTrue(a.contains(1, 10)); + assertTrue(a.contains(2, 0)); + assertTrue(a.contains(3, 100)); + assertTrue(a.contains(5, 19)); + assertTrue(a.contains(5, 20)); + assertFalse(a.contains(1, 9)); + assertFalse(a.contains(0, 0)); + assertFalse(a.contains(5, 21)) + }, "test: contains for single line ranges":function() { + var a = new b(1, 10, 1, 20); + assertTrue(a.contains(1, 10)); + assertTrue(a.contains(1, 15)); + assertTrue(a.contains(1, 20)); + assertFalse(a.contains(0, 9)); + assertFalse(a.contains(2, 9)); + assertFalse(a.contains(1, 9)); + assertFalse(a.contains(1, 21)) + }, "test: extend range":function() { + var a = new b(2, 10, 2, 30); + a = a.extend(2, 5); + assertRange(2, 5, 2, 30, a); + a = a.extend(2, 35); + assertRange(2, 5, 2, 35, a); + a = a.extend(2, 15); + assertRange(2, 5, 2, 35, a); + a = a.extend(1, 4); + assertRange(1, 4, 2, 35, a); + a = a.extend(6, 10); + assertRange(1, 4, 6, 10, a) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/SearchTest.js b/build/ace/test/SearchTest.js new file mode 100644 index 00000000..83494e64 --- /dev/null +++ b/build/ace/test/SearchTest.js @@ -0,0 +1,135 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Search"], function(c, b) { + new TestCase("SearchTest", {"test: configure the search object":function() { + (new b).set({needle:"juhu", scope:b.ALL}) + }, "test: find simple text in document":function() { + var a = new c(["juhu kinners 123", "456"]); + a = (new b).set({needle:"kinners"}).find(a); + assertPosition(0, 5, a.start); + assertPosition(0, 12, a.end) + }, "test: find simple text in next line":function() { + var a = new c(["abc", "juhu kinners 123", "456"]); + a = (new b).set({needle:"kinners"}).find(a); + assertPosition(1, 5, a.start); + assertPosition(1, 12, a.end) + }, "test: find text starting at cursor position":function() { + var a = new c(["juhu kinners", "juhu kinners 123"]); + a.getSelection().moveCursorTo(0, 6); + a = (new b).set({needle:"kinners"}).find(a); + assertPosition(1, 5, a.start); + assertPosition(1, 12, a.end) + }, "test: wrap search is off by default":function() { + var a = new c(["abc", "juhu kinners 123", "456"]); + a.getSelection().moveCursorTo(2, 1); + var d = (new b).set({needle:"kinners"}); + assertEquals(null, d.find(a)) + }, "test: wrap search should wrap at file end":function() { + var a = new c(["abc", "juhu kinners 123", "456"]); + a.getSelection().moveCursorTo(2, 1); + a = (new b).set({needle:"kinners", wrap:true}).find(a); + assertPosition(1, 5, a.start); + assertPosition(1, 12, a.end) + }, "test: wrap search with no match should return 'null'":function() { + var a = new c(["abc", "juhu kinners 123", "456"]); + a.getSelection().moveCursorTo(2, 1); + var d = (new b).set({needle:"xyz", wrap:true}); + assertEquals(null, d.find(a)) + }, "test: case sensitive is by default off":function() { + var a = new c(["abc", "juhu kinners 123", "456"]), d = (new b).set({needle:"JUHU"}); + assertEquals(null, d.find(a)) + }, "test: case sensitive search":function() { + var a = new c(["abc", "juhu kinners 123", "456"]); + a = (new b).set({needle:"KINNERS", caseSensitive:true}).find(a); + assertPosition(1, 5, a.start); + assertPosition(1, 12, a.end) + }, "test: whole word search should not match inside of words":function() { + var a = new c(["juhukinners", "juhu kinners 123", "456"]); + a = (new b).set({needle:"kinners", wholeWord:true}).find(a); + assertPosition(1, 5, a.start); + assertPosition(1, 12, a.end) + }, "test: find backwards":function() { + var a = new c(["juhu juhu juhu juhu"]); + a.getSelection().moveCursorTo(0, 10); + a = (new b).set({needle:"juhu", backwards:true}).find(a); + assertPosition(0, 5, a.start); + assertPosition(0, 9, a.end) + }, "test: find in selection":function() { + var a = new c(["juhu", "juhu", "juhu", "juhu"]); + a.getSelection().setSelectionAnchor(1, 0); + a.getSelection().selectTo(3, 5); + var d = (new b).set({needle:"juhu", wrap:true, scope:b.SELECTION}), e = d.find(a); + assertPosition(1, 0, e.start); + assertPosition(1, 4, e.end); + a.getSelection().setSelectionAnchor(0, 2); + a.getSelection().selectTo(3, 2); + e = d.find(a); + assertPosition(1, 0, e.start); + assertPosition(1, 4, e.end) + }, "test: find backwards in selection":function() { + var a = new c(["juhu", "juhu", "juhu", "juhu"]), d = (new b).set({needle:"juhu", wrap:true, backwards:true, scope:b.SELECTION}); + a.getSelection().setSelectionAnchor(0, 2); + a.getSelection().selectTo(3, 2); + var e = d.find(a); + assertPosition(2, 0, e.start); + assertPosition(2, 4, e.end); + a.getSelection().setSelectionAnchor(0, 2); + a.getSelection().selectTo(1, 2); + assertEquals(null, d.find(a)) + }, "test: edge case - match directly before the cursor":function() { + var a = new c(["123", "123", "juhu"]), d = (new b).set({needle:"juhu", wrap:true}); + a.getSelection().moveCursorTo(2, 5); + a = d.find(a); + assertPosition(2, 0, a.start); + assertPosition(2, 4, a.end) + }, "test: edge case - match backwards directly after the cursor":function() { + var a = new c(["123", "123", "juhu"]), d = (new b).set({needle:"juhu", wrap:true, backwards:true}); + a.getSelection().moveCursorTo(2, 0); + a = d.find(a); + assertPosition(2, 0, a.start); + assertPosition(2, 4, a.end) + }, "test: find using a regular expression":function() { + var a = new c(["abc123 123 cd", "abc"]); + a = (new b).set({needle:"\\d+", regExp:true}).find(a); + assertPosition(0, 3, a.start); + assertPosition(0, 6, a.end) + }, "test: find using a regular expression and whole word":function() { + var a = new c(["abc123 123 cd", "abc"]); + a = (new b).set({needle:"\\d+\\b", regExp:true, wholeWord:true}).find(a); + assertPosition(0, 7, a.start); + assertPosition(0, 10, a.end) + }, "test: use regular expressions with capture groups":function() { + var a = new c([" ab: 12px", " +*/ +require.def(["ace/Document"], function(c) { + TestCase("SelectionTest", {createTextDocument:function(a, b) { + b = (new Array(b + 1)).join("a"); + a = (new Array(a)).join(b + "\n") + b; + return new c(a) + }, "test: move cursor to end of file should place the cursor on last row and column":function() { + var a = this.createTextDocument(200, 10).getSelection(); + a.moveCursorFileEnd(); + assertPosition(199, 10, a.getCursor()) + }, "test: moveCursor to start of file should place the cursor on the first row and column":function() { + var a = this.createTextDocument(200, 10).getSelection(); + a.moveCursorFileStart(); + assertPosition(0, 0, a.getCursor()) + }, "test: move selection lead to end of file":function() { + var a = this.createTextDocument(200, 10).getSelection(); + a.moveCursorTo(100, 5); + a.selectFileEnd(); + a = a.getRange(); + assertPosition(100, 5, a.start); + assertPosition(199, 10, a.end) + }, "test: move selection lead to start of file":function() { + var a = this.createTextDocument(200, 10).getSelection(); + a.moveCursorTo(100, 5); + a.selectFileStart(); + a = a.getRange(); + assertPosition(0, 0, a.start); + assertPosition(100, 5, a.end) + }, "test: move cursor word right":function() { + var a = (new c("ab\n Juhu Kinners (abc, 12)\n cde")).getSelection(); + a.moveCursorDown(); + assertPosition(1, 0, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 1, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 5, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 6, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 13, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 15, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 18, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 20, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 22, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(1, 23, a.getCursor()); + a.moveCursorWordRight(); + assertPosition(2, 0, a.getCursor()) + }, "test: select word right if cursor in word":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 2); + a.moveCursorWordRight(); + assertPosition(0, 4, a.getCursor()) + }, "test: moveCursor word left":function() { + var a = (new c("ab\n Juhu Kinners (abc, 12)\n cde")).getSelection(); + a.moveCursorDown(); + a.moveCursorLineEnd(); + assertPosition(1, 23, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 22, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 20, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 18, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 15, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 13, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 6, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 5, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 1, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(1, 0, a.getCursor()); + a.moveCursorWordLeft(); + assertPosition(0, 2, a.getCursor()) + }, "test: select word left if cursor in word":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 8); + a.moveCursorWordLeft(); + assertPosition(0, 5, a.getCursor()) + }, "test: select word right and select":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 0); + a.selectWordRight(); + a = a.getRange(); + assertPosition(0, 0, a.start); + assertPosition(0, 4, a.end) + }, "test: select word left and select":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 3); + a.selectWordLeft(); + a = a.getRange(); + assertPosition(0, 0, a.start); + assertPosition(0, 3, a.end) + }, "test: select word with cursor in word should select the word":function() { + var a = (new c("Juhu Kinners 123")).getSelection(); + a.moveCursorTo(0, 8); + a.selectWord(); + a = a.getRange(); + assertPosition(0, 5, a.start); + assertPosition(0, 12, a.end) + }, "test: select word with cursor betwen white space and word should select the word":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 4); + a.selectWord(); + var b = a.getRange(); + assertPosition(0, 0, b.start); + assertPosition(0, 4, b.end); + a.moveCursorTo(0, 5); + a.selectWord(); + b = a.getRange(); + assertPosition(0, 5, b.start); + assertPosition(0, 12, b.end) + }, "test: select word with cursor in white space should select white space":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 5); + a.selectWord(); + a = a.getRange(); + assertPosition(0, 4, a.start); + assertPosition(0, 6, a.end) + }, "test: moving cursor should fire a 'changeCursor' event":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 5); + var b = false; + a.addEventListener("changeCursor", function() { + b = true + }); + a.moveCursorTo(0, 6); + assertTrue(b) + }, "test: calling setCursor with the same position should not fire an event":function() { + var a = (new c("Juhu Kinners")).getSelection(); + a.moveCursorTo(0, 5); + var b = false; + a.addEventListener("changeCursor", function() { + b = true + }); + a.moveCursorTo(0, 5); + assertFalse(b) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/TextEditTest.js b/build/ace/test/TextEditTest.js new file mode 100644 index 00000000..f69ce6f4 --- /dev/null +++ b/build/ace/test/TextEditTest.js @@ -0,0 +1,178 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Editor", "ace/mode/JavaScript", "ace/test/MockRenderer"], function(c, d, g, e) { + TestCase("TextEditTest", {"test: delete line from the middle":function() { + var b = new c("a\nb\nc\nd"), a = new d(new e, b); + a.moveCursorTo(1, 1); + a.removeLines(); + assertEquals("a\nc\nd", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + a.removeLines(); + assertEquals("a\nd", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + a.removeLines(); + assertEquals("a\n", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + a.removeLines(); + assertEquals("a\n", b.toString()); + assertPosition(1, 0, a.getCursorPosition()) + }, "test: delete multiple selected lines":function() { + var b = new c("a\nb\nc\nd"), a = new d(new e, b); + a.moveCursorTo(1, 1); + a.getSelection().selectDown(); + a.removeLines(); + assertEquals("a\nd", b.toString()); + assertPosition(1, 0, a.getCursorPosition()) + }, "test: delete first line":function() { + var b = new c("a\nb\nc"), a = new d(new e, b); + a.removeLines(); + assertEquals("b\nc", b.toString()); + assertPosition(0, 0, a.getCursorPosition()) + }, "test: delete last":function() { + var b = new c("a\nb\nc"), a = new d(new e, b); + a.moveCursorTo(2, 1); + a.removeLines(); + assertEquals("a\nb\n", b.toString()); + assertPosition(2, 0, a.getCursorPosition()) + }, "test: indent block":function() { + var b = new c("a12345\nb12345\nc12345"), a = new d(new e, b); + a.moveCursorTo(1, 3); + a.getSelection().selectDown(); + a.blockIndent(" "); + assertEquals("a12345\n b12345\n c12345", b.toString()); + assertPosition(2, 7, a.getCursorPosition()); + b = a.getSelectionRange(); + assertPosition(1, 7, b.start); + assertPosition(2, 7, b.end) + }, "test: outdent block":function() { + var b = new c(" a12345\n b12345\n c12345"), a = new d(new e, b); + a.moveCursorTo(0, 3); + a.getSelection().selectDown(); + a.getSelection().selectDown(); + a.blockOutdent(" "); + assertEquals(" a12345\nb12345\n c12345", b.toString()); + assertPosition(2, 1, a.getCursorPosition()); + var f = a.getSelectionRange(); + assertPosition(0, 1, f.start); + assertPosition(2, 1, f.end); + a.blockOutdent(" "); + assertEquals(" a12345\nb12345\n c12345", b.toString()); + f = a.getSelectionRange(); + assertPosition(0, 1, f.start); + assertPosition(2, 1, f.end) + }, "test: outent without a selection should update cursor":function() { + var b = new c(" 12"), a = new d(new e, b); + a.moveCursorTo(0, 3); + a.blockOutdent(" "); + assertEquals(" 12", b.toString()); + assertPosition(0, 1, a.getCursorPosition()) + }, "test: comment lines should perserve selection":function() { + var b = new c(" abc\ncde", new g), a = new d(new e, b); + a.moveCursorTo(0, 2); + a.getSelection().selectDown(); + a.toggleCommentLines(); + assertEquals("// abc\n//cde", b.toString()); + b = a.getSelectionRange(); + assertPosition(0, 4, b.start); + assertPosition(1, 4, b.end) + }, "test: uncomment lines should perserve selection":function() { + var b = new c("// abc\n//cde", new g), a = new d(new e, b); + a.moveCursorTo(0, 1); + a.getSelection().selectDown(); + a.getSelection().selectRight(); + a.getSelection().selectRight(); + a.toggleCommentLines(); + assertEquals(" abc\ncde", b.toString()); + assertRange(0, 0, 1, 1, a.getSelectionRange()) + }, "test: comment lines - if the selection end is at the line start it should stay there":function() { + var b = new c("abc\ncde", new g); + b = new d(new e, b); + b.moveCursorTo(0, 0); + b.getSelection().selectDown(); + b.toggleCommentLines(); + assertRange(0, 2, 1, 0, b.getSelectionRange()); + b = new c("abc\ncde", new g); + b = new d(new e, b); + b.moveCursorTo(1, 0); + b.getSelection().selectUp(); + b.toggleCommentLines(); + assertRange(0, 2, 1, 0, b.getSelectionRange()) + }, "test: move lines down should select moved lines":function() { + var b = new c("11\n22\n33\n44"), a = new d(new e, b); + a.moveCursorTo(0, 1); + a.getSelection().selectDown(); + a.moveLinesDown(); + assertEquals("33\n11\n22\n44", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + assertPosition(3, 0, a.getSelection().getSelectionAnchor()); + assertPosition(1, 0, a.getSelection().getSelectionLead()); + a.moveLinesDown(); + assertEquals("33\n44\n11\n22", b.toString()); + assertPosition(2, 0, a.getCursorPosition()); + assertPosition(3, 2, a.getSelection().getSelectionAnchor()); + assertPosition(2, 0, a.getSelection().getSelectionLead()); + a.moveLinesDown(); + assertEquals("33\n44\n11\n22", b.toString()); + assertPosition(2, 0, a.getCursorPosition()); + assertPosition(3, 2, a.getSelection().getSelectionAnchor()); + assertPosition(2, 0, a.getSelection().getSelectionLead()) + }, "test: move lines up should select moved lines":function() { + var b = new c("11\n22\n33\n44"), a = new d(new e, b); + a.moveCursorTo(2, 1); + a.getSelection().selectDown(); + a.moveLinesUp(); + assertEquals("11\n33\n44\n22", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + assertPosition(3, 0, a.getSelection().getSelectionAnchor()); + assertPosition(1, 0, a.getSelection().getSelectionLead()); + a.moveLinesUp(); + assertEquals("33\n44\n11\n22", b.toString()); + assertPosition(0, 0, a.getCursorPosition()); + assertPosition(2, 0, a.getSelection().getSelectionAnchor()); + assertPosition(0, 0, a.getSelection().getSelectionLead()) + }, "test: move line without active selection should move cursor to start of the moved line":function() { + var b = new c("11\n22\n33\n44"), a = new d(new e, b); + a.moveCursorTo(1, 1); + a.clearSelection(); + a.moveLinesDown(); + assertEquals("11\n33\n22\n44", b.toString()); + assertPosition(2, 0, a.getCursorPosition()); + a.clearSelection(); + a.moveLinesUp(); + assertEquals("11\n22\n33\n44", b.toString()); + assertPosition(1, 0, a.getCursorPosition()) + }, "test: copy lines down should select lines and place cursor at the selection start":function() { + var b = new c("11\n22\n33\n44"), a = new d(new e, b); + a.moveCursorTo(1, 1); + a.getSelection().selectDown(); + a.copyLinesDown(); + assertEquals("11\n22\n33\n22\n33\n44", b.toString()); + assertPosition(3, 0, a.getCursorPosition()); + assertPosition(5, 0, a.getSelection().getSelectionAnchor()); + assertPosition(3, 0, a.getSelection().getSelectionLead()) + }, "test: copy lines up should select lines and place cursor at the selection start":function() { + var b = new c("11\n22\n33\n44"), a = new d(new e, b); + a.moveCursorTo(1, 1); + a.getSelection().selectDown(); + a.copyLinesUp(); + assertEquals("11\n22\n33\n22\n33\n44", b.toString()); + assertPosition(1, 0, a.getCursorPosition()); + assertPosition(3, 0, a.getSelection().getSelectionAnchor()); + assertPosition(1, 0, a.getSelection().getSelectionLead()) + }, "test: input a tab with soft tab should convert it to spaces":function() { + var b = new c(""), a = new d(new e, b); + b.setTabSize(2); + b.setUseSoftTabs(true); + a.onTextInput("\t"); + assertEquals(" ", b.toString()); + b.setTabSize(5); + a.onTextInput("\t"); + assertEquals(" ", b.toString()) + }, "test: input tab without soft tabs should keep the tab character":function() { + var b = new c(""), a = new d(new e, b); + b.setUseSoftTabs(false); + a.onTextInput("\t"); + assertEquals("\t", b.toString()) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/VirtualRendererTest.js b/build/ace/test/VirtualRendererTest.js new file mode 100644 index 00000000..8c3a51c3 --- /dev/null +++ b/build/ace/test/VirtualRendererTest.js @@ -0,0 +1,27 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/VirtualRenderer"], function(c, d) { + new TestCase("VirtualRendererTest", {"test: screen2text the column should be rounded to the next character edge":function() { + var b = document.createElement("div"); + b.style.left = "0px"; + b.style.top = "0px"; + b.style.width = "100px"; + b.style.height = "100px"; + document.body.style.margin = "0px"; + document.body.style.padding = "0px"; + document.body.appendChild(b); + var a = new d(b); + a.setDocument(new c("1234")); + a.characterWidth = 10; + a.lineHeight = 15; + assertPosition(0, 0, a.screenToTextCoordinates(0, 0)); + assertPosition(0, 0, a.screenToTextCoordinates(4, 0)); + assertPosition(0, 1, a.screenToTextCoordinates(5, 0)); + assertPosition(0, 1, a.screenToTextCoordinates(9, 0)); + assertPosition(0, 1, a.screenToTextCoordinates(10, 0)); + assertPosition(0, 1, a.screenToTextCoordinates(14, 0)); + assertPosition(0, 2, a.screenToTextCoordinates(15, 0)); + document.body.removeChild(b) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/all.js b/build/ace/test/all.js new file mode 100644 index 00000000..ece34003 --- /dev/null +++ b/build/ace/test/all.js @@ -0,0 +1,4 @@ +require({paths:{ace:"../src/ace"}}, ["ace/test/assertions", "ace/test/ChangeDocumentTest"], function(a) { + console.log(a); + alert("a " + a) +}); \ No newline at end of file diff --git a/build/ace/test/assertions.js b/build/ace/test/assertions.js new file mode 100644 index 00000000..c7c5eefa --- /dev/null +++ b/build/ace/test/assertions.js @@ -0,0 +1,16 @@ +/* + LGPLv3 +*/ +require.def([], function() { + window.assertPosition = function(a, b, c) { + assertEquals(a, c.row); + assertEquals(b, c.column) + }; + window.assertRange = function(a, b, c, e, d) { + assertPosition(a, b, d.start); + assertPosition(c, e, d.end) + }; + window.assertJsonEquals = function(a, b) { + assertEquals(JSON.stringify(a), JSON.stringify(b)) + } +}); \ No newline at end of file diff --git a/build/ace/test/mode/CssTest.js b/build/ace/test/mode/CssTest.js new file mode 100644 index 00000000..d2a1eef8 --- /dev/null +++ b/build/ace/test/mode/CssTest.js @@ -0,0 +1,21 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Range", "ace/mode/Css"], function(b, c, d) { + new TestCase("mode.CssTest", {setUp:function() { + this.mode = new d + }, "test: toggle comment lines should not do anything":function() { + var a = new b(" abc\ncde\nfg"), e = new c(0, 3, 1, 1); + this.mode.toggleCommentLines("start", a, e); + assertEquals(" abc\ncde\nfg", a.toString()) + }, "test: lines should keep indentation":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc", " ")); + assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc", " ")) + }, "test: new line after { should increase indent":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc{", " ")); + assertEquals("\t ", this.mode.getNextLineIndent("start", "\tabc { ", " ")) + }, "test: no indent increase after { in a comment":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " /*{", " ")); + assertEquals(" ", this.mode.getNextLineIndent("start", " /*{ ", " ")) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/CssTokenizerTest.js b/build/ace/test/mode/CssTokenizerTest.js new file mode 100644 index 00000000..759dfb95 --- /dev/null +++ b/build/ace/test/mode/CssTokenizerTest.js @@ -0,0 +1,26 @@ +/* + LGPLv3 +*/ +require.def(["ace/mode/Css"], function(b) { + new TestCase("mode.CssTest", {setUp:function() { + this.tokenizer = (new b).getTokenizer() + }, "test: tokenize pixel number":function() { + var a = this.tokenizer.getLineTokens("-12px", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize hex3 color":function() { + var a = this.tokenizer.getLineTokens("#abc", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize hex6 color":function() { + var a = this.tokenizer.getLineTokens("#abc012", "start").tokens; + assertEquals(1, a.length); + assertEquals("number", a[0].type) + }, "test: tokenize parens":function() { + var a = this.tokenizer.getLineTokens("{()}", "start").tokens; + assertEquals(3, a.length); + assertEquals("lparen", a[0].type); + assertEquals("text", a[1].type); + assertEquals("rparen", a[2].type) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/HtmlTest.js b/build/ace/test/mode/HtmlTest.js new file mode 100644 index 00000000..2af56ba6 --- /dev/null +++ b/build/ace/test/mode/HtmlTest.js @@ -0,0 +1,16 @@ +/* + LGPLv3 +*/ +require.def(["ace/Document", "ace/Range", "ace/mode/Html"], function(b, c, d) { + new TestCase("mode.HtmlTest", {setUp:function() { + this.mode = new d + }, "test: toggle comment lines should not do anything":function() { + var a = new b([" abc", "cde", "fg"]), e = new c(0, 3, 1, 1); + this.mode.toggleCommentLines("start", a, e); + assertEquals(" abc\ncde\nfg", a.toString()) + }, "test: next line indent should be the same as the current line indent":function() { + assertEquals(" ", this.mode.getNextLineIndent("start", " abc")); + assertEquals("", this.mode.getNextLineIndent("start", "abc")); + assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc")) + }}) +}); \ No newline at end of file diff --git a/build/ace/test/mode/HtmlTokenizerTest.js b/build/ace/test/mode/HtmlTokenizerTest.js new file mode 100644 index 00000000..3ed6b4b2 --- /dev/null +++ b/build/ace/test/mode/HtmlTokenizerTest.js @@ -0,0 +1,21 @@ +/* + LGPLv3 +*/ +require.def(["ace/mode/Html"], function(b) { + new TestCase("mode.HtmlTest", {setUp:function() { + this.tokenizer = (new b).getTokenizer() + }, "test: tokenize embedded script":function() { + var a = this.tokenizer.getLineTokens(" + + + + + + + + + Document: + + JS Document + HTML Document + CSS Document + + + + Mode: + + Plain Text + JavaScript + XML + HTML + CSS + + + + Theme: + + TextMate + Eclipse + Dawn + idleFingers + Twilight + + + + Full line selections + + + + Highlight active line + + + + + + + + + + + + + + + + + + + + +