Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
6c7d09757b
127 changed files with 18800 additions and 2001 deletions
|
|
@ -1,3 +1,31 @@
|
|||
2011.02.14, Version 0.1.6
|
||||
|
||||
* Floating Anchors
|
||||
- An Anchor is a floating pointer in the document.
|
||||
- Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
- Usesd for the cursor and selection
|
||||
- Basis for bookmarks, multiple cursors and snippets in the future
|
||||
* Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
|
||||
* New commands:
|
||||
- center selection in viewport
|
||||
- remove to end/start of line
|
||||
- split line
|
||||
- transpose letters
|
||||
* Refator markers
|
||||
- Custom code can be used to render markers
|
||||
- Markers can be in front or behind the text
|
||||
- Markers are now stored in the session (was in the renderer)
|
||||
* Lots of IE8 fixes including copy, cut and selections
|
||||
* Unit tests can also be run in the browser <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
|
||||
* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
|
||||
* Add minimal node server server.js to run the Ace demo in Chrome
|
||||
* The top level editor.html demo has been renamed to index.html
|
||||
* Bug fixes
|
||||
- Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
|
||||
- Fixed isues when the editor was scrolled in the web page (Eric Allam)
|
||||
- Highlighting of Python string literals
|
||||
- Syntax rule for PHP comments
|
||||
|
||||
2011.02.08, Version 0.1.5
|
||||
|
||||
* Add Coffeescript Mode (Satoshi Murakami)
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -1,6 +1,8 @@
|
|||
build:
|
||||
mkdir -p build/src
|
||||
mkdir -p build/textarea/src
|
||||
./Makefile.dryice.js
|
||||
./Makefile.dryice.textarea.js
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ copy({
|
|||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/boot.js'
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
|
|
@ -166,9 +166,13 @@ copy({
|
|||
});
|
||||
|
||||
|
||||
// create modes
|
||||
console.log('# ace modes ---------');
|
||||
|
||||
project.assumeAllFilesLoaded();
|
||||
["css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp", "coffee"].forEach(function(mode) {
|
||||
[
|
||||
"css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp",
|
||||
"coffee", "perl"
|
||||
].forEach(function(mode) {
|
||||
console.log("mode " + mode);
|
||||
copy({
|
||||
source: [
|
||||
|
|
@ -182,7 +186,6 @@ project.assumeAllFilesLoaded();
|
|||
});
|
||||
});
|
||||
|
||||
// create worker
|
||||
console.log('# worker ---------');
|
||||
|
||||
var jsWorker = copy.createDataObject();
|
||||
|
|
@ -214,33 +217,11 @@ copy({
|
|||
dest: "build/src/worker-javascript.js"
|
||||
});
|
||||
|
||||
// create themes
|
||||
var eclipseTheme = copy.createDataObject();
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/eclipse.js"
|
||||
}],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: eclipseTheme
|
||||
});
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/eclipse.css"
|
||||
}],
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: eclipseTheme
|
||||
});
|
||||
copy({
|
||||
source: eclipseTheme,
|
||||
filter: [ copy.filter.uglifyjs ],
|
||||
dest: 'build/src/theme-eclipse.js'
|
||||
});
|
||||
console.log('# ace themes ---------');
|
||||
|
||||
[
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight"
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight", "eclipse"
|
||||
].forEach(function(theme) {
|
||||
copy({
|
||||
source: [{
|
||||
|
|
@ -268,7 +249,8 @@ project.assumeAllFilesLoaded();
|
|||
});
|
||||
|
||||
|
||||
// copy text files
|
||||
console.log('# License | Readme | Changelog ---------');
|
||||
|
||||
copy({
|
||||
source: aceHome + "/LICENSE",
|
||||
dest: 'build/LICENSE'
|
||||
|
|
@ -290,9 +272,9 @@ copy({
|
|||
// "ace", "cockpit",
|
||||
// "keybinding-vim", "keybinding-emacs",
|
||||
// "mode-javascript", "mode-css", "mode-html", "mode-php", "mode-python",
|
||||
// "mode-xml",
|
||||
// "mode-xml",
|
||||
// "theme-clouds", "theme-clouds_midnight", "theme-cobalt",
|
||||
// "theme-dawn", "theme-idle_fingers", "theme-kr_theme",
|
||||
// "theme-dawn", "theme-idle_fingers", "theme-kr_theme",
|
||||
// "theme-mono_industrial", "theme-monokai", "theme-pastel_on_dark",
|
||||
// "theme-twilight"
|
||||
// ].map(function(module) {
|
||||
|
|
@ -305,7 +287,7 @@ copy({
|
|||
// } ],
|
||||
// dest: "build/editor-demo.html"
|
||||
//});
|
||||
//copy({
|
||||
//copy({
|
||||
// source: [{
|
||||
// root: aceHome + '/demo',
|
||||
// include: "demo.js"
|
||||
|
|
@ -313,11 +295,11 @@ copy({
|
|||
// filter: [ copy.filter.moduleDefines ],
|
||||
// dest: "build/demo/demo.js"
|
||||
//});
|
||||
//copy({
|
||||
//copy({
|
||||
// source: aceHome + '/demo/styles.css',
|
||||
// dest: "build/demo/styles.css"
|
||||
//});
|
||||
//copy({
|
||||
//copy({
|
||||
// source: aceHome + '/demo/logo.png',
|
||||
// dest: "build/demo/logo.png"
|
||||
//});
|
||||
|
|
|
|||
182
Makefile.dryice.textarea.js
Executable file
182
Makefile.dryice.textarea.js
Executable file
|
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/env node
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var copy = require('dryice').copy;
|
||||
|
||||
var aceHome = __dirname;
|
||||
|
||||
function shadow(input) {
|
||||
if (typeof input !== 'string') {
|
||||
input = input.toString();
|
||||
}
|
||||
|
||||
return input.replace(/define\(/g, "__ace_shadowed__.define(");
|
||||
}
|
||||
|
||||
console.log('# ace ---------');
|
||||
|
||||
var project = copy.createCommonJsProject([
|
||||
aceHome + '/support/pilot/lib',
|
||||
aceHome + '/lib'
|
||||
]);
|
||||
|
||||
copy({
|
||||
source: "build_support/editor_textarea.html",
|
||||
dest: 'build/textarea/editor.html'
|
||||
});
|
||||
|
||||
var ace = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require_textarea.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate",
|
||||
"ace/mode/text",
|
||||
"ace/mode/matching_brace_outdent",
|
||||
"ace/virtual_renderer"
|
||||
]
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: project,
|
||||
include: /.*\.css$|.*\.html$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: project,
|
||||
include: /.*\.png$|.*\.gif$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.base64 ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/boot_textarea.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: ace,
|
||||
filter: [
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: 'build/textarea/src/ace.js'
|
||||
});
|
||||
copy({
|
||||
source: ace,
|
||||
filter: [
|
||||
shadow,
|
||||
],
|
||||
dest: 'build/textarea/src/ace-uncompressed.js'
|
||||
});
|
||||
|
||||
console.log('# ace modes ---------');
|
||||
|
||||
// create modes
|
||||
project.assumeAllFilesLoaded();
|
||||
[
|
||||
"css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp",
|
||||
"coffee", "perl"
|
||||
].forEach(function(mode) {
|
||||
console.log("mode " + mode);
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project.clone(),
|
||||
require: [ 'ace/mode/' + mode ]
|
||||
})
|
||||
],
|
||||
filter: [
|
||||
copy.filter.moduleDefines,
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: "build/textarea/src/mode-" + mode + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
console.log('# ace themes ---------');
|
||||
|
||||
// create themes
|
||||
[
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight", "eclipse"
|
||||
].forEach(function(theme) {
|
||||
console.log("theme " + theme);
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/" + theme + ".js"
|
||||
}],
|
||||
filter: [
|
||||
copy.filter.moduleDefines,
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: "build/textarea/src/theme-" + theme + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
console.log('# License | Readme | Changelog ---------');
|
||||
|
|
@ -22,6 +22,8 @@ Take Ace for a spin!
|
|||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/editor.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
2011.02.14, Version 0.1.6
|
||||
|
||||
* Floating Anchors
|
||||
- An Anchor is a floating pointer in the document.
|
||||
- Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
- Usesd for the cursor and selection
|
||||
- Basis for bookmarks, multiple cursors and snippets in the future
|
||||
* Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
|
||||
* New commands:
|
||||
- center selection in viewport
|
||||
- remove to end/start of line
|
||||
- split line
|
||||
- transpose letters
|
||||
* Refator markers
|
||||
- Custom code can be used to render markers
|
||||
- Markers can be in front or behind the text
|
||||
- Markers are now stored in the session (was in the renderer)
|
||||
* Lots of IE8 fixes including copy, cut and selections
|
||||
* Unit tests can also be run in the browser <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
|
||||
* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
|
||||
* Add minimal node server server.js to run the Ace demo in Chrome
|
||||
* The top level editor.html demo has been renamed to index.html
|
||||
* Bug fixes
|
||||
- Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
|
||||
- Fixed isues when the editor was scrolled in the web page (Eric Allam)
|
||||
- Highlighting of Python string literals
|
||||
- Syntax rule for PHP comments
|
||||
|
||||
2011.02.08, Version 0.1.5
|
||||
|
||||
* Add Coffeescript Mode (Satoshi Murakami)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ Take Ace for a spin!
|
|||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/editor.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet][http://ajaxorg.github.com/ace/build/textarea/editor.html].
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
|
|
@ -49,19 +51,19 @@ The easiest version is simply:
|
|||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
|
||||
By default the editor only supports plain text mode. However all other language modes are available as separate modules. After including the mode's Javascript file
|
||||
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
|
||||
the mode can be used like this:
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
define("ace/keyboard/keybinding/emacs",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||c==String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
define("ace/keyboard/keybinding/emacs",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/keyboard/keybinding/vim",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"i",then:"insertMode"},{regex:["([0-9]*)","(k|up)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(j|down|enter)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(l|right)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(h|left)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}]};b.Vim=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||c==String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
define("ace/keyboard/keybinding/vim",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"i",then:"insertMode"},{regex:["([0-9]*)","(k|up)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(j|down|enter)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(l|right)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(h|left)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}]};b.Vim=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/mode/c_cpp",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/c_cpp_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules;c_cppHighlightRules=function(){var a=new f,b=e.arrayToMap("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|typeid|bitor|extern|protected|typename|bool|false|public|union|break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|friend|return|virtual|char|goto|short|void|class|if|signed|volatile|compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|switch|delete|new|template|do|not|this|for".split("|")),c=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{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:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"},d.inherits(c_cppHighlightRules,g),b.c_cppHighlightRules=c_cppHighlightRules}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=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:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f})
|
||||
define("ace/mode/c_cpp",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/c_cpp_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|typeid|bitor|extern|protected|typename|bool|false|public|union|break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|friend|return|virtual|char|goto|short|void|class|if|signed|volatile|compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|switch|delete|new|template|do|not|this|for".split("|")),c=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{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:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.c_cppHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=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:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/mode/coffee",function(a,b,c){function h(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range;a("pilot/oop").inherits(h,a("ace/mode/text").Mode);var i=h.prototype,j=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,k=/^(\s*)#/,l=/^\s*###(?!#)/,m=/^\s*/;i.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&j.test(b)&&(d+=c);return d},i.toggleCommentLines=function(a,b,c,d){var e,f=new g(0,0,0,0);for(var h=c;h<=d;++h){var i=b.getLine(h);if(l.test(i))continue;i=(e=k.test(i))?i.replace(k,"$1"):i.replace(m,"$&#"),f.end.row=f.start.row=h,f.end.column=i.length+1,b.replace(f,i)}return 1-e*2},i.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},i.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)},b.Mode=h}),define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d})
|
||||
define("ace/mode/coffee",function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
build/src/mode-perl.js
Normal file
1
build/src/mode-perl.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/perl",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/perl_highlight_rules").PerlHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/perl_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars".split("|")),b=e.arrayToMap("ARGV|ENV|INC|SIG".split("|")),c=e.arrayToMap("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0x[0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PerlHighlightRules=g})
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules;PythonHighlightRules=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:(?:[rubRUB])|(?:[ubUB][rR]))?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:(?:.)|(?:^"{3}))*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:(?:\\\\.)|(?:[^"\\\\]))*?"'},{token:"string",regex:f+"'{3}(?:(?:.)|(?:^'{3}))*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:(?:\\\\.)|(?:[^'\\\\]))*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:^"{3})*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:^'{3})*?'{3}",next:"start"},{token:"string",regex:".+"}]}},d.inherits(PythonHighlightRules,f),b.PythonHighlightRules=PythonHighlightRules})
|
||||
define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h).replace(g,"$1");j.start.row=h,j.end.row=h,j.end.column=k.length+2,b.replace(j,k)}return-2}return b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){return this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules;RubyHighlightRules=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="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:"^=end$",next:"start"},{token:"comment",regex:".+"}]}},d.inherits(RubyHighlightRules,f),b.RubyHighlightRules=RubyHighlightRules})
|
||||
define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="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:"^=end$",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(g,f),b.RubyHighlightRules=g})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=a("text!ace/theme/eclipse.css");d.importCssString(e),b.cssClass="ace-eclipse"}),define("text!ace/theme/eclipse.css",".ace-eclipse .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-eclipse .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-eclipse .ace_gutter { width: 40px; background: rgb(227, 227, 227); border-right: 1px solid rgb(159, 159, 159);\t color: rgb(136, 136, 136);}.ace-eclipse .ace_gutter-layer { right: 10px; text-align: right;}.ace-eclipse .ace_text-layer { cursor: text;}.ace-eclipse .ace_cursor { border-left: 1px solid black;}.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable { color: rgb(127, 0, 85);}.ace-eclipse .ace_line .ace_constant.ace_buildin { color: rgb(88, 72, 246);}.ace-eclipse .ace_line .ace_constant.ace_library { color: rgb(6, 150, 14);}.ace-eclipse .ace_line .ace_function { color: rgb(60, 76, 114);}.ace-eclipse .ace_line .ace_string { color: rgb(42, 0, 255);}.ace-eclipse .ace_line .ace_comment { color: rgb(63, 127, 95);}.ace-eclipse .ace_line .ace_comment.ace_doc { color: rgb(63, 95, 191);}.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag { color: rgb(127, 159, 191);}.ace-eclipse .ace_line .ace_constant.ace_numeric {}.ace-eclipse .ace_line .ace_tag {\tcolor: rgb(63, 127, 127);}.ace-eclipse .ace_line .ace_xml_pe { color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection { background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_marker-layer .ace_active_line { background: rgb(232, 242, 254);}")
|
||||
define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 50px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-eclipse .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}";d.importCssString(e),b.cssClass="ace-eclipse"})
|
||||
|
|
@ -1 +1 @@
|
|||
define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"})
|
||||
define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n.ace-twilight.normal-mode .ace_cursor-layer {\n z-index: 0;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"})
|
||||
File diff suppressed because one or more lines are too long
129
build/textarea/editor.html
Normal file
129
build/textarea/editor.html
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Ace Bookmarklet Builder</h1>
|
||||
|
||||
<p>
|
||||
WARNING: Currently, this is only fully supported in non IE browsers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
How to use it:
|
||||
<ul>
|
||||
<li>Select the options below as you want them to be by default.</li>
|
||||
<li>Enter the "SourceUrl" where you placed the source data which you find under build/textarea/src (you can also leave the default to server the scripts from GitHub).</li>
|
||||
<li>Click the "Build Link" button to generate your custom Ace Bookmarklet.</li>
|
||||
<li>Drag the generated link to your toolbar or store it somewhere else.</li>
|
||||
<li>Go to a page with an textarea element and click the bookmarklet - wait a little bit till the files are loaded.</li>
|
||||
<li>Click 3 times on the textarea you want to replace - Ace will replace it.</li>
|
||||
<li>To change settings, just click the red icon in the bottom right corner.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<textarea id="textarea" style="width:300px; height:300px">
|
||||
function foo() {
|
||||
var bar = true;
|
||||
}
|
||||
</textarea><br>
|
||||
SourceUrl: <input id="srcURL" value="http://ajaxorg.github.com/ace/build/textarea/src/"></input>
|
||||
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
|
||||
<script>
|
||||
function inject() {
|
||||
var baseUrl = "src/";
|
||||
function load(path, module, callback) {
|
||||
path = baseUrl + path;
|
||||
if (!load.scripts[path]) {
|
||||
load.scripts[path] = {
|
||||
loaded: false,
|
||||
callbacks: [ callback ]
|
||||
};
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
function c() {
|
||||
if (window.__ace_shadowed__ && window.__ace_shadowed__.define.modules[module]) {
|
||||
load.scripts[path].loaded = true;
|
||||
load.scripts[path].callbacks.forEach(function(callback) {
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
setTimeout(c, 50);
|
||||
}
|
||||
};
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
c();
|
||||
} else if (load.scripts[path].loaded) {
|
||||
callback();
|
||||
} else {
|
||||
load.scripts[path].callbacks.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
load.scripts = {};
|
||||
window.__ace_shadowed_load__ = load;
|
||||
|
||||
load('ace.js', 'text!ace/css/editor.css', function() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
var Event = ace.require('pilot/event');
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
Event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
inject();
|
||||
|
||||
var textAce;
|
||||
function initAce() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
// Check if the ace.js file was loaded already, otherwise check back later.
|
||||
if (ace && ace.transformTextarea) {
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.transformTextarea(t);
|
||||
textAce.setDisplaySettings(true);
|
||||
} else {
|
||||
setTimeout(initAce, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
initAce();
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
|
||||
|
||||
var aceOptions = textAce.getOptions();
|
||||
var opt = [];
|
||||
for (var option in aceOptions) {
|
||||
opt.push(option + ":'" + aceOptions[option] + "'");
|
||||
}
|
||||
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")()";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
12927
build/textarea/src/ace-uncompressed.js
Normal file
12927
build/textarea/src/ace-uncompressed.js
Normal file
File diff suppressed because it is too large
Load diff
1
build/textarea/src/ace.js
Normal file
1
build/textarea/src/ace.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-c_cpp.js
Normal file
1
build/textarea/src/mode-c_cpp.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/c_cpp",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/c_cpp_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|typeid|bitor|extern|protected|typename|bool|false|public|union|break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|friend|return|virtual|char|goto|short|void|class|if|signed|volatile|compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|switch|delete|new|template|do|not|this|for".split("|")),c=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{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:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|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(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.c_cppHighlightRules=h}),__ace_shadowed__.define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=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:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f})
|
||||
1
build/textarea/src/mode-coffee.js
Normal file
1
build/textarea/src/mode-coffee.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/coffee",function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),__ace_shadowed__.define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d})
|
||||
1
build/textarea/src/mode-css.js
Normal file
1
build/textarea/src/mode-css.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-html.js
Normal file
1
build/textarea/src/mode-html.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-java.js
Normal file
1
build/textarea/src/mode-java.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-javascript.js
Normal file
1
build/textarea/src/mode-javascript.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-perl.js
Normal file
1
build/textarea/src/mode-perl.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/perl",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/perl_highlight_rules").PerlHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/perl_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars".split("|")),b=e.arrayToMap("ARGV|ENV|INC|SIG".split("|")),c=e.arrayToMap("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0x[0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PerlHighlightRules=g})
|
||||
1
build/textarea/src/mode-php.js
Normal file
1
build/textarea/src/mode-php.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-python.js
Normal file
1
build/textarea/src/mode-python.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g})
|
||||
1
build/textarea/src/mode-ruby.js
Normal file
1
build/textarea/src/mode-ruby.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="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:"^=end$",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(g,f),b.RubyHighlightRules=g})
|
||||
1
build/textarea/src/mode-xml.js
Normal file
1
build/textarea/src/mode-xml.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/xml",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/xml_highlight_rules").XmlHighlightRules,h=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(h,e),function(){this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(h.prototype),b.Mode=h}),__ace_shadowed__.define("ace/mode/xml_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=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:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f})
|
||||
1
build/textarea/src/theme-clouds.js
Normal file
1
build/textarea/src/theme-clouds.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/clouds",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-clouds .ace_text-layer {\n cursor: text;\n color: #000000;\n}\n\n.ace-clouds .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-clouds .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-clouds .ace_marker-layer .ace_selection {\n background: #BDD5FC;\n}\n\n.ace-clouds .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds .ace_marker-layer .ace_active_line {\n background: #FFFBD1;\n}\n\n \n.ace-clouds .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds .ace_keyword {\n color:#AF956F;\n}\n\n.ace-clouds .ace_keyword.ace_operator {\n color:#484848;\n}\n\n.ace-clouds .ace_constant {\n \n}\n\n.ace-clouds .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds .ace_constant.ace_library {\n \n}\n\n.ace-clouds .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds .ace_invalid {\n background-color:#FF002A;\n}\n\n.ace-clouds .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds .ace_support {\n \n}\n\n.ace-clouds .ace_support.ace_function {\n color:#C52727;\n}\n\n.ace-clouds .ace_function.ace_buildin {\n \n}\n\n.ace-clouds .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds .ace_string.ace_regexp {\n \n}\n\n.ace-clouds .ace_comment {\n color:#BCC8BA;\n}\n\n.ace-clouds .ace_comment.ace_doc {\n \n}\n\n.ace-clouds .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds .ace_variable {\n \n}\n\n.ace-clouds .ace_variable.ace_language {\n \n}\n\n.ace-clouds .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds"})
|
||||
1
build/textarea/src/theme-clouds_midnight.js
Normal file
1
build/textarea/src/theme-clouds_midnight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/clouds_midnight",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds-midnight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds-midnight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds-midnight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds-midnight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds-midnight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds-midnight .ace_scroller {\n background-color: #191919;\n}\n\n.ace-clouds-midnight .ace_text-layer {\n cursor: text;\n color: #929292;\n}\n\n.ace-clouds-midnight .ace_cursor {\n border-left: 2px solid #7DA5DC;\n}\n\n.ace-clouds-midnight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #7DA5DC;\n}\n \n.ace-clouds-midnight .ace_marker-layer .ace_selection {\n background: #000000;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_active_line {\n background: rgba(215, 215, 215, 0.031);\n}\n\n \n.ace-clouds-midnight .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_keyword {\n color:#927C5D;\n}\n\n.ace-clouds-midnight .ace_keyword.ace_operator {\n color:#4B4B4B;\n}\n\n.ace-clouds-midnight .ace_constant {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds-midnight .ace_constant.ace_library {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds-midnight .ace_invalid {\n color:#FFFFFF;\nbackground-color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds-midnight .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds-midnight .ace_support {\n \n}\n\n.ace-clouds-midnight .ace_support.ace_function {\n color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_function.ace_buildin {\n \n}\n\n.ace-clouds-midnight .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds-midnight .ace_string.ace_regexp {\n \n}\n\n.ace-clouds-midnight .ace_comment {\n color:#3C403B;\n}\n\n.ace-clouds-midnight .ace_comment.ace_doc {\n \n}\n\n.ace-clouds-midnight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds-midnight .ace_variable {\n \n}\n\n.ace-clouds-midnight .ace_variable.ace_language {\n \n}\n\n.ace-clouds-midnight .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds-midnight"})
|
||||
1
build/textarea/src/theme-cobalt.js
Normal file
1
build/textarea/src/theme-cobalt.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/cobalt",function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-cobalt .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-cobalt .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-cobalt .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-cobalt .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-cobalt .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-cobalt .ace_scroller {\n background-color: #002240;\n}\n\n.ace-cobalt .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-cobalt .ace_marker-layer .ace_selection {\n background: rgba(179, 101, 57, 0.75);\n}\n\n.ace-cobalt .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-cobalt .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.35);\n}\n\n \n.ace-cobalt .ace_invisible {\n color: rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_keyword {\n color:#FF9D00;\n}\n\n.ace-cobalt .ace_keyword.ace_operator {\n \n}\n\n.ace-cobalt .ace_constant {\n color:#FF628C;\n}\n\n.ace-cobalt .ace_constant.ace_language {\n \n}\n\n.ace-cobalt .ace_constant.ace_library {\n \n}\n\n.ace-cobalt .ace_constant.ace_numeric {\n \n}\n\n.ace-cobalt .ace_invalid {\n color:#F8F8F8;\nbackground-color:#800F00;\n}\n\n.ace-cobalt .ace_invalid.ace_illegal {\n \n}\n\n.ace-cobalt .ace_invalid.ace_deprecated {\n \n}\n\n.ace-cobalt .ace_support {\n color:#80FFBB;\n}\n\n.ace-cobalt .ace_support.ace_function {\n color:#FFB054;\n}\n\n.ace-cobalt .ace_function.ace_buildin {\n \n}\n\n.ace-cobalt .ace_string {\n \n}\n\n.ace-cobalt .ace_string.ace_regexp {\n color:#80FFC2;\n}\n\n.ace-cobalt .ace_comment {\n font-style:italic;\ncolor:#0088FF;\n}\n\n.ace-cobalt .ace_comment.ace_doc {\n \n}\n\n.ace-cobalt .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-cobalt .ace_variable {\n color:#CCCCCC;\n}\n\n.ace-cobalt .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-cobalt .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-cobalt"})
|
||||
1
build/textarea/src/theme-dawn.js
Normal file
1
build/textarea/src/theme-dawn.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/dawn",function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-dawn .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-dawn .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-dawn .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-dawn .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-dawn .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-dawn .ace_scroller {\n background-color: #F9F9F9;\n}\n\n.ace-dawn .ace_text-layer {\n cursor: text;\n color: #080808;\n}\n\n.ace-dawn .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-dawn .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-dawn .ace_marker-layer .ace_selection {\n background: rgba(39, 95, 255, 0.30);\n}\n\n.ace-dawn .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-dawn .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_marker-layer .ace_active_line {\n background: rgba(36, 99, 180, 0.12);\n}\n\n \n.ace-dawn .ace_invisible {\n color: rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_keyword {\n color:#794938;\n}\n\n.ace-dawn .ace_keyword.ace_operator {\n \n}\n\n.ace-dawn .ace_constant {\n color:#811F24;\n}\n\n.ace-dawn .ace_constant.ace_language {\n \n}\n\n.ace-dawn .ace_constant.ace_library {\n \n}\n\n.ace-dawn .ace_constant.ace_numeric {\n \n}\n\n.ace-dawn .ace_invalid {\n \n}\n\n.ace-dawn .ace_invalid.ace_illegal {\n text-decoration:underline;\nfont-style:italic;\ncolor:#F8F8F8;\nbackground-color:#B52A1D;\n}\n\n.ace-dawn .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#B52A1D;\n}\n\n.ace-dawn .ace_support {\n color:#691C97;\n}\n\n.ace-dawn .ace_support.ace_function {\n color:#693A17;\n}\n\n.ace-dawn .ace_function.ace_buildin {\n \n}\n\n.ace-dawn .ace_string {\n color:#0B6125;\n}\n\n.ace-dawn .ace_string.ace_regexp {\n color:#CF5628;\n}\n\n.ace-dawn .ace_comment {\n font-style:italic;\ncolor:#5A525F;\n}\n\n.ace-dawn .ace_comment.ace_doc {\n \n}\n\n.ace-dawn .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-dawn .ace_variable {\n color:#234A97;\n}\n\n.ace-dawn .ace_variable.ace_language {\n \n}\n\n.ace-dawn .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-dawn"})
|
||||
1
build/textarea/src/theme-eclipse.js
Normal file
1
build/textarea/src/theme-eclipse.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 50px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-eclipse .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}";d.importCssString(e),b.cssClass="ace-eclipse"})
|
||||
1
build/textarea/src/theme-idle_fingers.js
Normal file
1
build/textarea/src/theme-idle_fingers.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/idle_fingers",function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-idle-fingers .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-idle-fingers .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-idle-fingers .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-idle-fingers .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-idle-fingers .ace_scroller {\n background-color: #323232;\n}\n\n.ace-idle-fingers .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-idle-fingers .ace_cursor {\n border-left: 2px solid #91FF00;\n}\n\n.ace-idle-fingers .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #91FF00;\n}\n \n.ace-idle-fingers .ace_marker-layer .ace_selection {\n background: rgba(90, 100, 126, 0.88);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #404040;\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_active_line {\n background: #353637;\n}\n\n \n.ace-idle-fingers .ace_invisible {\n color: #404040;\n}\n\n.ace-idle-fingers .ace_keyword {\n color:#CC7833;\n}\n\n.ace-idle-fingers .ace_keyword.ace_operator {\n \n}\n\n.ace-idle-fingers .ace_constant {\n color:#6C99BB;\n}\n\n.ace-idle-fingers .ace_constant.ace_language {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_library {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_numeric {\n \n}\n\n.ace-idle-fingers .ace_invalid {\n color:#FFFFFF;\nbackground-color:#FF0000;\n}\n\n.ace-idle-fingers .ace_invalid.ace_illegal {\n \n}\n\n.ace-idle-fingers .ace_invalid.ace_deprecated {\n \n}\n\n.ace-idle-fingers .ace_support {\n color:#bc9458;\n}\n\n.ace-idle-fingers .ace_support.ace_function {\n color:#B83426;\n}\n\n.ace-idle-fingers .ace_function.ace_buildin {\n \n}\n\n.ace-idle-fingers .ace_string {\n color:#A5C261;\n}\n\n.ace-idle-fingers .ace_string.ace_regexp {\n color:#CCCC33;\n}\n\n.ace-idle-fingers .ace_comment {\n font-style:italic;\n color:#BC9458;\n}\n\n.ace-idle-fingers .ace_comment.ace_doc {\n \n}\n\n.ace-idle-fingers .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-idle-fingers .ace_variable {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_variable.ace_language {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-idle-fingers"})
|
||||
1
build/textarea/src/theme-kr_theme.js
Normal file
1
build/textarea/src/theme-kr_theme.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/kr_theme",function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-kr-theme .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-kr-theme .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-kr-theme .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-kr-theme .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-kr-theme .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-kr-theme .ace_scroller {\n background-color: #0B0A09;\n}\n\n.ace-kr-theme .ace_text-layer {\n cursor: text;\n color: #FCFFE0;\n}\n\n.ace-kr-theme .ace_cursor {\n border-left: 2px solid #FF9900;\n}\n\n.ace-kr-theme .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FF9900;\n}\n \n.ace-kr-theme .ace_marker-layer .ace_selection {\n background: rgba(170, 0, 255, 0.45);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_active_line {\n background: #38403D;\n}\n\n \n.ace-kr-theme .ace_invisible {\n color: rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_keyword {\n color:#949C8B;\n}\n\n.ace-kr-theme .ace_keyword.ace_operator {\n \n}\n\n.ace-kr-theme .ace_constant {\n color:rgba(210, 117, 24, 0.76);\n}\n\n.ace-kr-theme .ace_constant.ace_language {\n \n}\n\n.ace-kr-theme .ace_constant.ace_library {\n \n}\n\n.ace-kr-theme .ace_constant.ace_numeric {\n \n}\n\n.ace-kr-theme .ace_invalid {\n color:#F8F8F8;\nbackground-color:#A41300;\n}\n\n.ace-kr-theme .ace_invalid.ace_illegal {\n \n}\n\n.ace-kr-theme .ace_invalid.ace_deprecated {\n \n}\n\n.ace-kr-theme .ace_support {\n color:#9FC28A;\n}\n\n.ace-kr-theme .ace_support.ace_function {\n color:#85873A;\n}\n\n.ace-kr-theme .ace_function.ace_buildin {\n \n}\n\n.ace-kr-theme .ace_string {\n \n}\n\n.ace-kr-theme .ace_string.ace_regexp {\n color:rgba(125, 255, 192, 0.65);\n}\n\n.ace-kr-theme .ace_comment {\n font-style:italic;\ncolor:#706D5B;\n}\n\n.ace-kr-theme .ace_comment.ace_doc {\n \n}\n\n.ace-kr-theme .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-kr-theme .ace_variable {\n color:#D1A796;\n}\n\n.ace-kr-theme .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-kr-theme .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-kr-theme"})
|
||||
1
build/textarea/src/theme-mono_industrial.js
Normal file
1
build/textarea/src/theme-mono_industrial.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/mono_industrial",function(a,b,c){var d=a("pilot/dom"),e=".ace-mono-industrial .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-mono-industrial .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-mono-industrial .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-mono-industrial .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-mono-industrial .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-mono-industrial .ace_scroller {\n background-color: #222C28;\n}\n\n.ace-mono-industrial .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-mono-industrial .ace_marker-layer .ace_selection {\n background: rgba(145, 153, 148, 0.40);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_active_line {\n background: rgba(12, 13, 12, 0.25);\n}\n\n \n.ace-mono-industrial .ace_invisible {\n color: rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_keyword {\n color:#A39E64;\n}\n\n.ace-mono-industrial .ace_keyword.ace_operator {\n color:#A8B3AB;\n}\n\n.ace-mono-industrial .ace_constant {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_constant.ace_language {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_library {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_numeric {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_invalid {\n color:#FFFFFF;\nbackground-color:rgba(153, 0, 0, 0.68);\n}\n\n.ace-mono-industrial .ace_invalid.ace_illegal {\n \n}\n\n.ace-mono-industrial .ace_invalid.ace_deprecated {\n \n}\n\n.ace-mono-industrial .ace_support {\n \n}\n\n.ace-mono-industrial .ace_support.ace_function {\n color:#588E60;\n}\n\n.ace-mono-industrial .ace_function.ace_buildin {\n \n}\n\n.ace-mono-industrial .ace_string {\n \n}\n\n.ace-mono-industrial .ace_string.ace_regexp {\n \n}\n\n.ace-mono-industrial .ace_comment {\n color:#666C68;\nbackground-color:#151C19;\n}\n\n.ace-mono-industrial .ace_comment.ace_doc {\n \n}\n\n.ace-mono-industrial .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-mono-industrial .ace_variable {\n \n}\n\n.ace-mono-industrial .ace_variable.ace_language {\n color:#648BD2;\n}\n\n.ace-mono-industrial .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-mono-industrial"})
|
||||
1
build/textarea/src/theme-monokai.js
Normal file
1
build/textarea/src/theme-monokai.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/monokai",function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-monokai .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-monokai .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-monokai .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-monokai .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-monokai .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-monokai .ace_scroller {\n background-color: #272822;\n}\n\n.ace-monokai .ace_text-layer {\n cursor: text;\n color: #F8F8F2;\n}\n\n.ace-monokai .ace_cursor {\n border-left: 2px solid #F8F8F0;\n}\n\n.ace-monokai .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #F8F8F0;\n}\n \n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_active_line {\n background: #49483E;\n}\n\n \n.ace-monokai .ace_invisible {\n color: #49483E;\n}\n\n.ace-monokai .ace_keyword {\n color:#F92672;\n}\n\n.ace-monokai .ace_keyword.ace_operator {\n \n}\n\n.ace-monokai .ace_constant {\n \n}\n\n.ace-monokai .ace_constant.ace_language {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_constant.ace_library {\n \n}\n\n.ace-monokai .ace_constant.ace_numeric {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_invalid {\n color:#F8F8F0;\nbackground-color:#F92672;\n}\n\n.ace-monokai .ace_invalid.ace_illegal {\n \n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color:#F8F8F0;\nbackground-color:#AE81FF;\n}\n\n.ace-monokai .ace_support {\n \n}\n\n.ace-monokai .ace_support.ace_function {\n color:#66D9EF;\n}\n\n.ace-monokai .ace_function.ace_buildin {\n \n}\n\n.ace-monokai .ace_string {\n color:#E6DB74;\n}\n\n.ace-monokai .ace_string.ace_regexp {\n \n}\n\n.ace-monokai .ace_comment {\n color:#75715E;\n}\n\n.ace-monokai .ace_comment.ace_doc {\n \n}\n\n.ace-monokai .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-monokai .ace_variable {\n \n}\n\n.ace-monokai .ace_variable.ace_language {\n \n}\n\n.ace-monokai .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-monokai"})
|
||||
1
build/textarea/src/theme-pastel_on_dark.js
Normal file
1
build/textarea/src/theme-pastel_on_dark.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/pastel_on_dark",function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-pastel-on-dark .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-pastel-on-dark .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-pastel-on-dark .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-pastel-on-dark .ace_scroller {\n background-color: #2c2828;\n}\n\n.ace-pastel-on-dark .ace_text-layer {\n cursor: text;\n color: #8f938f;\n}\n\n.ace-pastel-on-dark .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-pastel-on-dark .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-pastel-on-dark .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-pastel-on-dark .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_keyword {\n color:#757ad8;\n}\n\n.ace-pastel-on-dark .ace_keyword.ace_operator {\n color:#797878;\n}\n\n.ace-pastel-on-dark .ace_constant {\n color:#4fb7c5;\n}\n\n.ace-pastel-on-dark .ace_constant.ace_language {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_library {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_numeric {\n \n}\n\n.ace-pastel-on-dark .ace_invalid {\n \n}\n\n.ace-pastel-on-dark .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-pastel-on-dark .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-pastel-on-dark .ace_support {\n color:#9a9a9a;\n}\n\n.ace-pastel-on-dark .ace_support.ace_function {\n color:#aeb2f8;\n}\n\n.ace-pastel-on-dark .ace_function.ace_buildin {\n \n}\n\n.ace-pastel-on-dark .ace_string {\n color:#66a968;\n}\n\n.ace-pastel-on-dark .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-pastel-on-dark .ace_comment {\n color:#656865;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_variable {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_variable.ace_language {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"})
|
||||
1
build/textarea/src/theme-twilight.js
Normal file
1
build/textarea/src/theme-twilight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n.ace-twilight.normal-mode .ace_cursor-layer {\n z-index: 0;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"})
|
||||
519
build_support/boot_textarea.js
Normal file
519
build_support/boot_textarea.js
Normal file
|
|
@ -0,0 +1,519 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
(function() {
|
||||
|
||||
var require = window.__ace_shadowed__.require;
|
||||
var deps = [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/virtual_renderer",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate"
|
||||
];
|
||||
|
||||
require(deps, function() {
|
||||
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index" ]);
|
||||
|
||||
var Dom = require("pilot/dom");
|
||||
var Event = require("pilot/event");
|
||||
var UA = require("pilot/useragent")
|
||||
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
||||
window.__ace_shadowed__.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setUndoManager(new UndoManager());
|
||||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el, "ace/theme/textmate"));
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
env.document = doc;
|
||||
env.editor = env;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
});
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the CSS property of element.
|
||||
* 1) If the CSS property is on the style object of the element, use it, OR
|
||||
* 2) Compute the CSS property
|
||||
*
|
||||
* If the property can't get computed, is 'auto' or 'intrinsic', the former
|
||||
* calculated property is uesd (this can happen in cases where the textarea
|
||||
* is hidden and has no dimension styles).
|
||||
*/
|
||||
var getCSSProperty = function(element, container, property) {
|
||||
var ret = element.style[property];
|
||||
|
||||
if (!ret) {
|
||||
if (window.getComputedStyle) {
|
||||
ret = window.getComputedStyle(element, '').getPropertyValue(property);
|
||||
} else {
|
||||
ret = element.currentStyle[property];
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret || ret == 'auto' || ret == 'intrinsic') {
|
||||
ret = container.style[property];
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
function applyStyles(elm, styles) {
|
||||
for (style in styles) {
|
||||
elm.style[style] = styles[style];
|
||||
}
|
||||
}
|
||||
|
||||
function setupContainer(element, getValue) {
|
||||
if (element.type != 'textarea') {
|
||||
throw "Textarea required!";
|
||||
}
|
||||
|
||||
var parentNode = element.parentNode;
|
||||
|
||||
// This will hold the Bespin editor.
|
||||
var container = document.createElement('div');
|
||||
|
||||
// To put Bespin in the place of the textarea, we have to copy a
|
||||
// few of the textarea's style attributes to the div container.
|
||||
//
|
||||
// The problem is, that the properties have to get computed (they
|
||||
// might be defined by a CSS file on the page - you can't access
|
||||
// such rules that apply to an element via elm.style). Computed
|
||||
// properties are converted to pixels although the dimension might
|
||||
// be given as percentage. When the window resizes, the dimensions
|
||||
// defined by percentages changes, so the properties have to get
|
||||
// recomputed to get the new/true pixels.
|
||||
var resizeEvent = function() {
|
||||
var style = 'position:relative;';
|
||||
[
|
||||
'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
|
||||
].forEach(function(item) {
|
||||
style += item + ':' +
|
||||
getCSSProperty(element, container, item) + ';';
|
||||
});
|
||||
|
||||
// Calculating the width/height of the textarea is somewhat
|
||||
// tricky. To do it right, you have to include the paddings
|
||||
// to the sides as well (eg. width = width + padding-left, -right).
|
||||
// This works well, as long as the width of the element is not
|
||||
// set or given in pixels. In this case and after the textarea
|
||||
// is hidden, getCSSProperty(element, container, 'width') will
|
||||
// still return pixel value. If the element has realtiv dimensions
|
||||
// (e.g. width='95<percent>') getCSSProperty(...) will return pixel values
|
||||
// only as long as the textarea is visible. After it is hidden
|
||||
// getCSSProperty will return the relativ dimensions as they
|
||||
// are set on the element (in the case of width, 95<percent>).
|
||||
// Making the sum of pixel vaules (e.g. padding) and realtive
|
||||
// values (e.g. <percent>) is not possible. As such the padding styles
|
||||
// are ignored.
|
||||
|
||||
// The complete width is the width of the textarea + the padding
|
||||
// to the left and right.
|
||||
var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
|
||||
var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
|
||||
style += 'height:' + height + ';width:' + width + ';';
|
||||
|
||||
// Set the display property to 'inline-block'.
|
||||
style += 'display:inline-block;';
|
||||
container.setAttribute('style', style);
|
||||
};
|
||||
Event.addListener(window, 'resize', resizeEvent);
|
||||
|
||||
// Call the resizeEvent once, so that the size of the container is
|
||||
// calculated.
|
||||
resizeEvent();
|
||||
|
||||
// Insert the div container after the element.
|
||||
if (element.nextSibling) {
|
||||
parentNode.insertBefore(container, element.nextSibling);
|
||||
} else {
|
||||
parentNode.appendChild(container);
|
||||
}
|
||||
|
||||
// Override the forms onsubmit function. Set the innerHTML and value
|
||||
// of the textarea before submitting.
|
||||
while (parentNode !== document) {
|
||||
if (parentNode.tagName.toUpperCase() === 'FORM') {
|
||||
var oldSumit = parentNode.onsubmit;
|
||||
// Override the onsubmit function of the form.
|
||||
parentNode.onsubmit = function(evt) {
|
||||
element.value = getValue();
|
||||
element.innerHTML = getValue();
|
||||
// If there is a onsubmit function already, then call
|
||||
// it with the current context and pass the event.
|
||||
if (oldSumit) {
|
||||
oldSumit.call(this, evt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
parentNode = parentNode.parentNode;
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
window.__ace_shadowed__.transformTextarea = function(element) {
|
||||
var session;
|
||||
var container = setupContainer(element, function() {
|
||||
return session.getValue();
|
||||
});
|
||||
|
||||
// Hide the element.
|
||||
element.style.display = 'none';
|
||||
container.style.background = 'white';
|
||||
|
||||
//
|
||||
var editorDiv = document.createElement("div");
|
||||
applyStyles(editorDiv, {
|
||||
top: "0px",
|
||||
left: "0px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
border: "1px solid gray"
|
||||
});
|
||||
container.appendChild(editorDiv);
|
||||
|
||||
var settingOpener = document.createElement("div");
|
||||
applyStyles(settingOpener, {
|
||||
position: "absolute",
|
||||
width: "15px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
background: "red",
|
||||
cursor: "pointer",
|
||||
textAlign: "center",
|
||||
fontSize: "12px"
|
||||
});
|
||||
settingOpener.innerHTML = "I";
|
||||
|
||||
var settingDiv = document.createElement("div");
|
||||
var settingDivStyles = {
|
||||
top: "0px",
|
||||
left: "0px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
position: "absolute",
|
||||
padding: "5px",
|
||||
zIndex: 100,
|
||||
color: "white",
|
||||
display: "none",
|
||||
overflow: "auto",
|
||||
fontSize: "14px"
|
||||
};
|
||||
if (!UA.isIE) {
|
||||
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
|
||||
} else {
|
||||
settingDivStyles.backgroundColor = "#333";
|
||||
}
|
||||
|
||||
applyStyles(settingDiv, settingDivStyles);
|
||||
container.appendChild(settingDiv);
|
||||
|
||||
// Power up ace on the textarea:
|
||||
var ace = window.__ace_shadowed__;
|
||||
var require = ace.require;
|
||||
var define = ace.define;
|
||||
var options = {};
|
||||
|
||||
var editor = ace.edit(editorDiv);
|
||||
session = editor.getSession();
|
||||
|
||||
session.setValue(element.value || element.innerHTML);
|
||||
editor.focus();
|
||||
|
||||
// Add the settingPanel opener to the editor's div.
|
||||
editorDiv.appendChild(settingOpener);
|
||||
|
||||
// Create the API.
|
||||
var api = setupApi(editor, editorDiv, settingDiv, ace, options)
|
||||
|
||||
// Create the setting's panel.
|
||||
setupSettingPanel(settingDiv, settingOpener, api, options);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
function setupApi(editor, editorDiv, settingDiv, ace, options) {
|
||||
var session = editor.getSession();
|
||||
var renderer = editor.renderer;
|
||||
|
||||
function toBool(value) {
|
||||
return value == "true";
|
||||
}
|
||||
|
||||
var ret = {
|
||||
setDisplaySettings: function(display) {
|
||||
settingDiv.style.display = display ? "block" : "none";
|
||||
},
|
||||
|
||||
setOption: function(key, value) {
|
||||
if (options[key] == value) return;
|
||||
|
||||
var load = window.__ace_shadowed_load__;
|
||||
|
||||
switch (key) {
|
||||
case "gutter":
|
||||
renderer.setShowGutter(toBool(value));
|
||||
break;
|
||||
|
||||
case "mode":
|
||||
if (value != "text") {
|
||||
// Load the required mode file. Files get loaded only once.
|
||||
load("mode-" + value + ".js", "ace/mode/" + value, function() {
|
||||
var aceMode = require("ace/mode/" + value).Mode;
|
||||
session.setMode(new aceMode());
|
||||
});
|
||||
} else {
|
||||
session.setMode(new (require("ace/mode/text").Mode));
|
||||
}
|
||||
break;
|
||||
|
||||
case "theme":
|
||||
if (value != "textmate") {
|
||||
// Load the required theme file. Files get loaded only once.
|
||||
load("theme-" + value + ".js", "ace/theme/" + value, function() {
|
||||
editor.setTheme("ace/theme/" + value);
|
||||
});
|
||||
} else {
|
||||
editor.setTheme("ace/theme/textmate");
|
||||
}
|
||||
break;
|
||||
|
||||
case "fontSize":
|
||||
editorDiv.style.fontSize = value;
|
||||
break;
|
||||
|
||||
case "softWrap":
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "showPrintMargin":
|
||||
renderer.setShowPrintMargin(toBool(value));
|
||||
break
|
||||
}
|
||||
|
||||
options[key] = value;
|
||||
},
|
||||
|
||||
getOption: function(key) {
|
||||
return options[key];
|
||||
},
|
||||
|
||||
getOptions: function() {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
for (option in ace.options) {
|
||||
ret.setOption(option, ace.options[option]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function setupSettingPanel(settingDiv, settingOpener, api, options) {
|
||||
var BOOL = {
|
||||
"true": true,
|
||||
"false": false
|
||||
}
|
||||
|
||||
var desc = {
|
||||
mode: "Mode:",
|
||||
gutter: "Display Gutter:",
|
||||
theme: "Theme:",
|
||||
fontSize: "Font Size:",
|
||||
softWrap: "Soft Wrap:",
|
||||
showPrintMargin: "Show Print Margin:"
|
||||
}
|
||||
|
||||
var optionValues = {
|
||||
mode: {
|
||||
text: "Plain",
|
||||
javascript: "JavaScript",
|
||||
coffee: "CoffeeScript",
|
||||
html: "HTML",
|
||||
css: "CSS",
|
||||
c_cpp: "C++",
|
||||
php: "PHP",
|
||||
ruby: "Ruby",
|
||||
python: "Python"
|
||||
|
||||
},
|
||||
theme: {
|
||||
textmate: "Textmate",
|
||||
eclipse: "Eclipse",
|
||||
clouds: "Clouds",
|
||||
clouds_midnight: "Clouds Midnight",
|
||||
cobalt: "Cobalt",
|
||||
dawn: "Dawn",
|
||||
idle_fingers: "Idle Fingers",
|
||||
kr_theme: "Kr Theme",
|
||||
mono_industrial: "Mono Industrial",
|
||||
monokai: "Monokai",
|
||||
pastel_on_dark: "Pastel On Dark",
|
||||
twilight: "Twilight"
|
||||
},
|
||||
gutter: BOOL,
|
||||
fontSize: {
|
||||
"10px": "10px",
|
||||
"11px": "11px",
|
||||
"12px": "12px",
|
||||
"14px": "14px",
|
||||
"16px": "16px"
|
||||
},
|
||||
softWrap: {
|
||||
off: "Off",
|
||||
40: "40",
|
||||
80: "80",
|
||||
free: "Free"
|
||||
},
|
||||
showPrintMargin: BOOL
|
||||
}
|
||||
|
||||
var table = [];
|
||||
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
|
||||
|
||||
function renderOption(builder, option, obj, cValue) {
|
||||
builder.push("<select title='" + option + "'>")
|
||||
for (var value in obj) {
|
||||
builder.push("<option value='" + value + "' ");
|
||||
|
||||
if (cValue == value) {
|
||||
builder.push(" selected ");
|
||||
}
|
||||
|
||||
builder.push(">",
|
||||
obj[value],
|
||||
"</option>");
|
||||
}
|
||||
builder.push("</select>")
|
||||
}
|
||||
|
||||
for (var option in options) {
|
||||
table.push("<tr><td>", desc[option], "</td>");
|
||||
table.push("<td>");
|
||||
renderOption(table, option, optionValues[option], options[option]);
|
||||
table.push("</td></tr>");
|
||||
}
|
||||
table.push("</table>");
|
||||
settingDiv.innerHTML = table.join("");
|
||||
|
||||
var selects = settingDiv.getElementsByTagName("select");
|
||||
for (var i = 0; i < selects.length; i++) {
|
||||
var onChange = (function() {
|
||||
var select = selects[i];
|
||||
return function() {
|
||||
var option = select.title;
|
||||
var value = select.value;
|
||||
api.setOption(option, value);
|
||||
}
|
||||
})();
|
||||
selects[i].onchange = onChange;
|
||||
}
|
||||
|
||||
var button = document.createElement("input");
|
||||
button.type = "button";
|
||||
button.value = "Hide";
|
||||
button.onclick = function() {
|
||||
api.setDisplaySettings(false);
|
||||
}
|
||||
settingDiv.appendChild(button);
|
||||
|
||||
settingOpener.onclick = function() {
|
||||
api.setDisplaySettings(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Default startup options.
|
||||
window.__ace_shadowed__.options = {
|
||||
mode: "text",
|
||||
theme: "textmate",
|
||||
gutter: "false",
|
||||
fontSize: "12px",
|
||||
softWrap: "off",
|
||||
showPrintMargin: "false"
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})()
|
||||
129
build_support/editor_textarea.html
Normal file
129
build_support/editor_textarea.html
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Ace Bookmarklet Builder</h1>
|
||||
|
||||
<p>
|
||||
WARNING: Currently, this is only fully supported in non IE browsers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
How to use it:
|
||||
<ul>
|
||||
<li>Select the options below as you want them to be by default.</li>
|
||||
<li>Enter the "SourceUrl" where you placed the source data which you find under build/textarea/src (you can also leave the default to server the scripts from GitHub).</li>
|
||||
<li>Click the "Build Link" button to generate your custom Ace Bookmarklet.</li>
|
||||
<li>Drag the generated link to your toolbar or store it somewhere else.</li>
|
||||
<li>Go to a page with an textarea element and click the bookmarklet - wait a little bit till the files are loaded.</li>
|
||||
<li>Click 3 times on the textarea you want to replace - Ace will replace it.</li>
|
||||
<li>To change settings, just click the red icon in the bottom right corner.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<textarea id="textarea" style="width:300px; height:300px">
|
||||
function foo() {
|
||||
var bar = true;
|
||||
}
|
||||
</textarea><br>
|
||||
SourceUrl: <input id="srcURL" value="http://ajaxorg.github.com/ace/build/textarea/src/"></input>
|
||||
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
|
||||
<script>
|
||||
function inject() {
|
||||
var baseUrl = "src/";
|
||||
function load(path, module, callback) {
|
||||
path = baseUrl + path;
|
||||
if (!load.scripts[path]) {
|
||||
load.scripts[path] = {
|
||||
loaded: false,
|
||||
callbacks: [ callback ]
|
||||
};
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
function c() {
|
||||
if (window.__ace_shadowed__ && window.__ace_shadowed__.define.modules[module]) {
|
||||
load.scripts[path].loaded = true;
|
||||
load.scripts[path].callbacks.forEach(function(callback) {
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
setTimeout(c, 50);
|
||||
}
|
||||
};
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
c();
|
||||
} else if (load.scripts[path].loaded) {
|
||||
callback();
|
||||
} else {
|
||||
load.scripts[path].callbacks.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
load.scripts = {};
|
||||
window.__ace_shadowed_load__ = load;
|
||||
|
||||
load('ace.js', 'text!ace/css/editor.css', function() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
var Event = ace.require('pilot/event');
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
Event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
inject();
|
||||
|
||||
var textAce;
|
||||
function initAce() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
// Check if the ace.js file was loaded already, otherwise check back later.
|
||||
if (ace && ace.transformTextarea) {
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.transformTextarea(t);
|
||||
textAce.setDisplaySettings(true);
|
||||
} else {
|
||||
setTimeout(initAce, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
initAce();
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
|
||||
|
||||
var aceOptions = textAce.getOptions();
|
||||
var opt = [];
|
||||
for (var option in aceOptions) {
|
||||
opt.push(option + ":'" + aceOptions[option] + "'");
|
||||
}
|
||||
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")()";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
128
build_support/mini_require_textarea.js
Normal file
128
build_support/mini_require_textarea.js
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Define a module along with a payload
|
||||
* @param module a name for the payload
|
||||
* @param payload a function to call with (require, exports, module) params
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var _define = function(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
if (_define.original)
|
||||
_define.original.apply(window, arguments);
|
||||
else {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_define.modules)
|
||||
_define.modules = {};
|
||||
|
||||
_define.modules[module] = payload;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get at functionality define()ed using the function above
|
||||
*/
|
||||
var _require = function(module, callback) {
|
||||
if (Object.prototype.toString.call(module) === "[object Array]") {
|
||||
var params = [];
|
||||
for (var i = 0, l = module.length; i < l; ++i) {
|
||||
var dep = lookup(module[i]);
|
||||
if (!dep && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
params.push(dep);
|
||||
};
|
||||
if (callback) {
|
||||
callback.apply(null, params);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module === 'string') {
|
||||
var payload = lookup(module);
|
||||
if (!payload && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
return payload;
|
||||
};
|
||||
}
|
||||
|
||||
_require.packaged = true;
|
||||
_require.noWorker = true;
|
||||
|
||||
/**
|
||||
* Internal function to lookup moduleNames and resolve them by calling the
|
||||
* definition function if needed.
|
||||
*/
|
||||
var lookup = function(moduleName) {
|
||||
var module = _define.modules[moduleName];
|
||||
if (module == null) {
|
||||
console.error('Missing module: ' + moduleName);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof module === 'function') {
|
||||
var exports = {};
|
||||
module(_require, exports, { id: moduleName, uri: '' });
|
||||
// cache the resulting module object for next time
|
||||
_define.modules[moduleName] = exports;
|
||||
return exports;
|
||||
}
|
||||
|
||||
return module;
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose as "shadowed" object to the outside world.
|
||||
*/
|
||||
|
||||
window.__ace_shadowed__ = {
|
||||
require: _require,
|
||||
define: _define
|
||||
};
|
||||
|
||||
})();
|
||||
29
demo/demo.js
29
demo/demo.js
|
|
@ -57,6 +57,7 @@ exports.launch = function(env) {
|
|||
var RubyMode = require("ace/mode/ruby").Mode;
|
||||
var CCPPMode = require("ace/mode/c_cpp").Mode;
|
||||
var CoffeeMode = require("ace/mode/coffee").Mode;
|
||||
var PerlMode = require("ace/mode/perl").Mode;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
|
||||
|
|
@ -84,6 +85,7 @@ exports.launch = function(env) {
|
|||
}
|
||||
docs.plain = new EditSession(loreIpsum);
|
||||
docs.plain.setUseWrapMode(true);
|
||||
docs.plain.setWrapLimitRange(80, 80)
|
||||
docs.plain.setMode(new TextMode());
|
||||
docs.plain.setUndoManager(new UndoManager());
|
||||
|
||||
|
|
@ -123,6 +125,10 @@ exports.launch = function(env) {
|
|||
docs.coffee.setMode(new CoffeeMode());
|
||||
docs.coffee.setUndoManager(new UndoManager());
|
||||
|
||||
docs.perl = new EditSession(document.getElementById("perltext").innerHTML);
|
||||
docs.perl.setMode(new PerlMode());
|
||||
docs.perl.setUndoManager(new UndoManager());
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
env.editor = new Editor(new Renderer(container, theme));
|
||||
|
||||
|
|
@ -137,7 +143,8 @@ exports.launch = function(env) {
|
|||
java: new JavaMode(),
|
||||
ruby: new RubyMode(),
|
||||
c_cpp: new CCPPMode(),
|
||||
coffee: new CoffeeMode()
|
||||
coffee: new CoffeeMode(),
|
||||
perl: new PerlMode()
|
||||
};
|
||||
|
||||
function getMode() {
|
||||
|
|
@ -182,6 +189,9 @@ exports.launch = function(env) {
|
|||
else if (mode instanceof CoffeeMode) {
|
||||
modeEl.value = "coffee";
|
||||
}
|
||||
else if (mode instanceof PerlMode) {
|
||||
modeEl.value = "perl";
|
||||
}
|
||||
else {
|
||||
modeEl.value = "text";
|
||||
}
|
||||
|
|
@ -189,7 +199,7 @@ exports.launch = function(env) {
|
|||
if (!doc.getUseWrapMode()) {
|
||||
wrapModeEl.value = "off";
|
||||
} else {
|
||||
wrapModeEl.value = doc.getWrapLimit();
|
||||
wrapModeEl.value = doc.getWrapLimitRange().min || "free";
|
||||
}
|
||||
env.editor.focus();
|
||||
});
|
||||
|
|
@ -220,12 +230,17 @@ exports.launch = function(env) {
|
|||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(40);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(80);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
|
|
@ -251,6 +266,10 @@ exports.launch = function(env) {
|
|||
env.editor.renderer.setShowPrintMargin(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_selected_word", function(checked) {
|
||||
env.editor.setHighlightSelectedWord(checked);
|
||||
});
|
||||
|
||||
function bindCheckbox(id, callback) {
|
||||
var el = document.getElementById(id);
|
||||
var onCheck = function() {
|
||||
|
|
@ -315,6 +334,8 @@ exports.launch = function(env) {
|
|||
mode = "c_cpp";
|
||||
} else if (/^.*\.coffee$/i.test(file.name)) {
|
||||
mode = "coffee";
|
||||
} else if (/^.*\.(pl|pm)$/i.test(file.name)) {
|
||||
mode = "perl";
|
||||
}
|
||||
|
||||
env.editor.onTextInput(reader.result);
|
||||
|
|
|
|||
273
editor.html
273
editor.html
|
|
@ -1,273 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
<link rel="stylesheet" href="demo/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
<option value="python">Python Document</option>
|
||||
<option value="php">PHP Document</option>
|
||||
<option value="java">Java Document</option>
|
||||
<option value="ruby">Ruby Document</option>
|
||||
<option value="c_cpp">C++ Document</option>
|
||||
<option value="coffee">CoffeeScript Document</option>
|
||||
<option value="plain">Text Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/textmate">TextMate</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="fontsize">Font Size:</label>
|
||||
<select id="fontsize" size="1">
|
||||
<option value="10px">10px</option>
|
||||
<option value="11px">11px</option>
|
||||
<option value="12px" selected="selected">12px</option>
|
||||
<option value="14px">14px</option>
|
||||
<option value="16px">16px</option>
|
||||
<option value="20px">20px</option>
|
||||
<option value="24px">24px</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="select_style">Full Line Selection</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="highlight_active">Highlight Active Line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_hidden">Show Invisibles</label>
|
||||
<input type="checkbox" name="show_hidden" id="show_hidden">
|
||||
</td>
|
||||
<td align="right" rowspan="2">
|
||||
<img src="demo/logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
<option value="python">Python</option>
|
||||
<option value="php">PHP</option>
|
||||
<option value="java">Java</option>
|
||||
<option value="ruby">Ruby</option>
|
||||
<option value="c_cpp">C/C++</option>
|
||||
<option value="coffee">CoffeeScript</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="keybinding">Key Binding:</label>
|
||||
<select id="keybinding" size="1">
|
||||
<option value="ace">Ace</option>
|
||||
<option value="vim">Vim</option>
|
||||
<option value="emacs">Emacs</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="soft_wrap">Soft Wrap:</label>
|
||||
<select id="soft_wrap" size="1">
|
||||
<option value="off">Off</option>
|
||||
<option value="40">40 Chars</option>
|
||||
<option value="80">80 Chars</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_gutter">Show Gutter</label>
|
||||
<input type="checkbox" id="show_gutter" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_print_margin">Show Print Margin</label>
|
||||
<input type="checkbox" id="show_print_margin" checked>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}
|
||||
// A magic character: >> ぁ <<
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html></script>
|
||||
|
||||
<script type="text/editor" id="javatext">public class InfiniteLoop {
|
||||
|
||||
/*
|
||||
* This will cause the program to hang...
|
||||
*
|
||||
* Taken from:
|
||||
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
double d = Double.parseDouble("2.2250738585072012e-308");
|
||||
|
||||
// unreachable code
|
||||
System.out.println("Value: " + d);
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print 'Usage: celsius temp1 temp2 ...'
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
<script type="text/editor" id="plaintext">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
|
||||
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
|
||||
|
||||
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
|
||||
|
||||
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="rubytext">#!/usr/bin/ruby
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
1
|
||||
else
|
||||
n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="cpptext">// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
return 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="coffeetext">#!/usr/bin/env coffee
|
||||
|
||||
try
|
||||
throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
|
||||
catch e
|
||||
console.log 'qstring' + "qqstring" + '''
|
||||
qdoc
|
||||
''' + """
|
||||
qqdoc
|
||||
"""
|
||||
|
||||
do ->
|
||||
###
|
||||
herecomment
|
||||
###
|
||||
re = /regex/imgy.test ///
|
||||
heregex # comment
|
||||
///imgy
|
||||
this isnt: `just JavaScript`
|
||||
undefined
|
||||
|
||||
var illegal</script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="demo/boot.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
317
index.html
317
index.html
|
|
@ -1 +1,316 @@
|
|||
<script>location.href = "http://ace.ajax.org"</script>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
<link rel="stylesheet" href="demo/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
<option value="python">Python Document</option>
|
||||
<option value="php">PHP Document</option>
|
||||
<option value="java">Java Document</option>
|
||||
<option value="ruby">Ruby Document</option>
|
||||
<option value="c_cpp">C++ Document</option>
|
||||
<option value="coffee">CoffeeScript Document</option>
|
||||
<option value="perl">Perl Document</option>
|
||||
<option value="plain">Text Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/textmate">TextMate</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="fontsize">Font Size:</label>
|
||||
<select id="fontsize" size="1">
|
||||
<option value="10px">10px</option>
|
||||
<option value="11px">11px</option>
|
||||
<option value="12px" selected="selected">12px</option>
|
||||
<option value="14px">14px</option>
|
||||
<option value="16px">16px</option>
|
||||
<option value="20px">20px</option>
|
||||
<option value="24px">24px</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="select_style">Full Line Selection</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="highlight_active">Highlight Active Line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_hidden">Show Invisibles</label>
|
||||
<input type="checkbox" name="show_hidden" id="show_hidden">
|
||||
</td>
|
||||
<td align="right" rowspan="2">
|
||||
<img src="demo/logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
<option value="python">Python</option>
|
||||
<option value="php">PHP</option>
|
||||
<option value="java">Java</option>
|
||||
<option value="ruby">Ruby</option>
|
||||
<option value="c_cpp">C/C++</option>
|
||||
<option value="coffee">CoffeeScript</option>
|
||||
<option value="perl">Perl</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="keybinding">Key Binding:</label>
|
||||
<select id="keybinding" size="1">
|
||||
<option value="ace">Ace</option>
|
||||
<option value="vim">Vim</option>
|
||||
<option value="emacs">Emacs</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="soft_wrap">Soft Wrap:</label>
|
||||
<select id="soft_wrap" size="1">
|
||||
<option value="off">Off</option>
|
||||
<option value="40">40 Chars</option>
|
||||
<option value="80">80 Chars</option>
|
||||
<option value="free">Free</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_gutter">Show Gutter</label>
|
||||
<input type="checkbox" id="show_gutter" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_print_margin">Show Print Margin</label>
|
||||
<input type="checkbox" id="show_print_margin" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="highlight_selected_word">Highlight selected word</label>
|
||||
<input type="checkbox" id="highlight_selected_word" checked>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}
|
||||
// A magic character: >> ぁ <<
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html></script>
|
||||
|
||||
<script type="text/editor" id="javatext">public class InfiniteLoop {
|
||||
|
||||
/*
|
||||
* This will cause the program to hang...
|
||||
*
|
||||
* Taken from:
|
||||
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
double d = Double.parseDouble("2.2250738585072012e-308");
|
||||
|
||||
// unreachable code
|
||||
System.out.println("Value: " + d);
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print 'Usage: celsius temp1 temp2 ...'
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
<script type="text/editor" id="plaintext">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
|
||||
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
|
||||
|
||||
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
|
||||
|
||||
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="rubytext">#!/usr/bin/ruby
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
1
|
||||
else
|
||||
n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="cpptext">// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
return 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="coffeetext">#!/usr/bin/env coffee
|
||||
|
||||
try
|
||||
throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
|
||||
catch e
|
||||
console.log 'qstring' + "qqstring" + '''
|
||||
qdoc
|
||||
''' + """
|
||||
qqdoc
|
||||
"""
|
||||
|
||||
do ->
|
||||
###
|
||||
herecomment
|
||||
###
|
||||
re = /regex/imgy.test ///
|
||||
heregex # comment
|
||||
///imgy
|
||||
this isnt: `just JavaScript`
|
||||
undefined
|
||||
|
||||
var illegal</script>
|
||||
|
||||
<script type="text/editor" id="perltext">
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
my $num_primes = 0;
|
||||
my @primes;
|
||||
|
||||
# Put 2 as the first prime so we won't have an empty array
|
||||
$primes[$num_primes] = 2;
|
||||
$num_primes++;
|
||||
|
||||
MAIN_LOOP:
|
||||
for my $number_to_check (3 .. 200)
|
||||
{
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
if ($number_to_check % $primes[$p] == 0)
|
||||
{
|
||||
next MAIN_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
# If we reached this point it means $number_to_check is not
|
||||
# divisable by any prime number that came before it.
|
||||
$primes[$num_primes] = $number_to_check;
|
||||
$num_primes++;
|
||||
}
|
||||
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
print $primes[$p], ", ";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
</script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="demo/boot.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
182
lib/ace/anchor.js
Normal file
182
lib/ace/anchor.js
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* An Anchor is a floating pointer in the document. Whenever text is inserted or
|
||||
* deleted before the cursor, the position of the cursor is updated
|
||||
*/
|
||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
this.document = doc;
|
||||
|
||||
if (typeof column == "undefined")
|
||||
this.setPosition(row.row, row.column)
|
||||
else
|
||||
this.setPosition(row, column);
|
||||
|
||||
this.$onChange = this.onChange.bind(this);
|
||||
doc.on("change", this.$onChange);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.getPosition = function() {
|
||||
return this.$clipPositionToDocument(this.row, this.column);
|
||||
};
|
||||
|
||||
this.getDocument = function() {
|
||||
return this.document;
|
||||
};
|
||||
|
||||
this.onChange = function(e) {
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
|
||||
if (range.start.row == range.end.row && range.start.row != this.row)
|
||||
return;
|
||||
|
||||
if (range.start.row > this.row)
|
||||
return;
|
||||
|
||||
if (range.start.row == this.row && range.start.column > this.column)
|
||||
return;
|
||||
|
||||
var row = this.row;
|
||||
var column = this.column;
|
||||
|
||||
if (delta.action === "insertText") {
|
||||
if (range.start.row === row && range.start.column <= column) {
|
||||
if (range.start.row === range.end.row) {
|
||||
column += range.end.column - range.start.column;
|
||||
}
|
||||
else {
|
||||
column -= range.start.column;
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
}
|
||||
else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
} else if (delta.action === "insertLines") {
|
||||
if (range.start.row <= row) {
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
}
|
||||
else if (delta.action == "removeText") {
|
||||
if (range.start.row == row && range.start.column < column) {
|
||||
if (range.end.column >= column)
|
||||
column = range.start.column;
|
||||
else
|
||||
column = Math.max(0, column - (range.end.column - range.start.column));
|
||||
|
||||
} else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||
if (range.end.row == row) {
|
||||
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||
}
|
||||
row -= (range.end.row - range.start.row);
|
||||
}
|
||||
else if (range.end.row == row) {
|
||||
row -= range.end.row - range.start.row;
|
||||
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||
}
|
||||
} else if (delta.action == "removeLines") {
|
||||
if (range.start.row <= row) {
|
||||
if (range.end.row <= row)
|
||||
row -= range.end.row - range.start.row;
|
||||
else {
|
||||
row = range.start.row;
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setPosition(row, column);
|
||||
};
|
||||
|
||||
this.setPosition = function(row, column) {
|
||||
pos = this.$clipPositionToDocument(row, column);
|
||||
if (this.row == pos.row && this.column == pos.column)
|
||||
return;
|
||||
|
||||
var old = {
|
||||
row: this.row,
|
||||
column: this.column
|
||||
};
|
||||
|
||||
this.row = pos.row;
|
||||
this.column = pos.column;
|
||||
this._dispatchEvent("change", {
|
||||
old: old,
|
||||
value: pos
|
||||
});
|
||||
};
|
||||
|
||||
this.detach = function() {
|
||||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
if (row >= this.document.getLength()) {
|
||||
pos.row = Math.max(0, this.document.getLength() - 1);
|
||||
pos.column = this.document.getLine(pos.row).length;
|
||||
}
|
||||
else if (row < 0) {
|
||||
pos.row = 0;
|
||||
pos.column = 0;
|
||||
}
|
||||
else {
|
||||
pos.row = row;
|
||||
pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
|
||||
}
|
||||
|
||||
if (column < 0)
|
||||
pos.column = 0;
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
}).call(Anchor.prototype);
|
||||
|
||||
});
|
||||
|
|
@ -48,7 +48,7 @@ canon.addCommand({
|
|||
|
||||
canon.addCommand({
|
||||
name: "selectall",
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
|
||||
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removeline",
|
||||
|
|
@ -242,6 +242,22 @@ canon.addCommand({
|
|||
name: "backspace",
|
||||
exec: function(env, args, request) { env.editor.removeLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removetolinestart",
|
||||
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removetolineend",
|
||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removewordleft",
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removewordright",
|
||||
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "outdent",
|
||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||
|
|
@ -253,9 +269,21 @@ canon.addCommand({
|
|||
canon.addCommand({
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "",
|
||||
args.times || 1));
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "centerselection",
|
||||
exec: function(env, args, request) { env.editor.centerSelection(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "splitline",
|
||||
exec: function(env, args, request) { env.editor.splitLine(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "transposeletters",
|
||||
exec: function(env, args, request) { env.editor.transposeLetters(); }
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@
|
|||
}
|
||||
|
||||
.ace_marker-layer {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_step {
|
||||
|
|
@ -143,3 +144,11 @@
|
|||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selected_word {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
this.getValue = function() {
|
||||
return this.$lines.join(this.getNewLineCharacter());
|
||||
return this.getAllLines().join(this.getNewLineCharacter());
|
||||
};
|
||||
|
||||
// check for IE split bug
|
||||
|
|
@ -123,11 +123,11 @@ var Document = function(text) {
|
|||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
return this.$lines[row] || "";
|
||||
return this.getLines(row, row + 1)[0] || "";
|
||||
};
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.$lines.slice(firstRow, lastRow+1);
|
||||
return this.$lines.slice(firstRow, lastRow + 1);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -135,7 +135,7 @@ var Document = function(text) {
|
|||
* should not modify this array!
|
||||
*/
|
||||
this.getAllLines = function() {
|
||||
return this.$lines;
|
||||
return this.getLines(0, this.getLength());
|
||||
};
|
||||
|
||||
this.getLength = function() {
|
||||
|
|
@ -183,14 +183,29 @@ var Document = function(text) {
|
|||
var end = this.insertInLine(position, text);
|
||||
}
|
||||
else {
|
||||
var end = this.insertInLine(position, newLines[0]);
|
||||
this.insertNewLine(end);
|
||||
if (newLines.length > 2)
|
||||
this.insertLines(position.row+1, newLines.slice(1, newLines.length-1));
|
||||
|
||||
var end = this.insertInLine({row: position.row + newLines.length - 1, column: 0}, newLines[newLines.length-1]);
|
||||
if (newLines[0].length > 0) {
|
||||
var end = this.insertInLine(position, newLines[0]);
|
||||
this.insertNewLine(end);
|
||||
}
|
||||
// If we are inserting at the end of the document, we don't need to
|
||||
// use insertInLine (concorde depends on this optimization!)
|
||||
if (position.row + 1 == this.getLength()) {
|
||||
this.insertLines(position.row + 1,
|
||||
newLines.slice(1, newLines.length));
|
||||
var end = {
|
||||
row: position.row + newLines.length - 1,
|
||||
column: position.column + newLines[newLines.length - 1].length
|
||||
};
|
||||
} else {
|
||||
if (newLines.length > 2)
|
||||
this.insertLines(position.row + 1,
|
||||
newLines.slice(1, newLines.length - 1));
|
||||
var end = this.insertInLine({
|
||||
row: position.row + newLines.length - 1,
|
||||
column: 0
|
||||
}, newLines[newLines.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
|
|
@ -202,7 +217,7 @@ var Document = function(text) {
|
|||
args.push.apply(args, lines);
|
||||
this.$lines.splice.apply(this.$lines, args);
|
||||
|
||||
var range = new Range(row, 0, row + lines.length - 1, 0);
|
||||
var range = new Range(row, 0, row + lines.length, 0);
|
||||
var delta = {
|
||||
action: "insertLines",
|
||||
range: range,
|
||||
|
|
@ -278,7 +293,7 @@ var Document = function(text) {
|
|||
this.removeLines(firstFullRow, lastFullRow);
|
||||
|
||||
if (firstFullRow != firstRow) {
|
||||
this.removeInLine(firstRow, range.start.column, this.$lines[firstRow].length);
|
||||
this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
|
||||
this.removeNewLine(range.start.row);
|
||||
}
|
||||
}
|
||||
|
|
@ -315,7 +330,7 @@ var Document = function(text) {
|
|||
* @return {String[]} The removed lines
|
||||
*/
|
||||
this.removeLines = function(firstRow, lastRow) {
|
||||
var range = new Range(firstRow, 0, lastRow, this.$lines[lastRow].length);
|
||||
var range = new Range(firstRow, 0, lastRow + 1, 0);
|
||||
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
|
||||
|
||||
var delta = {
|
||||
|
|
@ -375,7 +390,7 @@ var Document = function(text) {
|
|||
else if (delta.action == "insertText")
|
||||
this.insert(range.start, delta.text)
|
||||
else if (delta.action == "removeLines")
|
||||
this.removeLines(range.start.row, range.end.row)
|
||||
this.removeLines(range.start.row, range.end.row - 1)
|
||||
else if (delta.action == "removeText")
|
||||
this.remove(range)
|
||||
}
|
||||
|
|
@ -387,7 +402,7 @@ var Document = function(text) {
|
|||
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
||||
|
||||
if (delta.action == "insertLines")
|
||||
this.removeLines(range.start.row, range.end.row)
|
||||
this.removeLines(range.start.row, range.end.row - 1)
|
||||
else if (delta.action == "insertText")
|
||||
this.remove(range)
|
||||
else if (delta.action == "removeLines")
|
||||
|
|
|
|||
|
|
@ -49,8 +49,10 @@ var NO_CHANGE_DELTAS = {};
|
|||
|
||||
var EditSession = function(text, mode) {
|
||||
this.$modified = true;
|
||||
this.selection = new Selection(this);
|
||||
this.$breakpoints = [];
|
||||
this.$frontMarkers = {};
|
||||
this.$backMarkers = {};
|
||||
this.$markerId = 1;
|
||||
this.$wrapData = [];
|
||||
this.listeners = [];
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ var EditSession = function(text, mode) {
|
|||
this.setDocument(new Document(text));
|
||||
}
|
||||
|
||||
this.selection = new Selection(this);
|
||||
if (mode)
|
||||
this.setMode(mode);
|
||||
};
|
||||
|
|
@ -204,6 +207,44 @@ var EditSession = function(text, mode) {
|
|||
return this.$breakpoints;
|
||||
};
|
||||
|
||||
this.addMarker = function(range, clazz, type, inFront) {
|
||||
var id = this.$markerId++;
|
||||
|
||||
var marker = {
|
||||
range : range,
|
||||
type : type || "line",
|
||||
renderer: typeof type == "function" ? type : null,
|
||||
clazz : clazz,
|
||||
inFront: !!inFront
|
||||
}
|
||||
|
||||
if (inFront) {
|
||||
this.$frontMarkers[id] = marker;
|
||||
this._dispatchEvent("changeFrontMarker")
|
||||
} else {
|
||||
this.$backMarkers[id] = marker;
|
||||
this._dispatchEvent("changeBackMarker")
|
||||
}
|
||||
|
||||
return id;
|
||||
};
|
||||
|
||||
this.removeMarker = function(markerId) {
|
||||
var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
|
||||
if (!marker)
|
||||
return;
|
||||
|
||||
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
||||
if (marker) {
|
||||
delete (markers[markerId]);
|
||||
this._dispatchEvent(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
||||
}
|
||||
};
|
||||
|
||||
this.getMarkers = function(inFront) {
|
||||
return inFront ? this.$frontMarkers : this.$backMarkers;
|
||||
};
|
||||
|
||||
/**
|
||||
* Error:
|
||||
* {
|
||||
|
|
@ -293,7 +334,7 @@ var EditSession = function(text, mode) {
|
|||
if (this.$worker)
|
||||
this.$worker.terminate();
|
||||
|
||||
if (window.Worker)
|
||||
if (window.Worker && !require.noWorker)
|
||||
this.$worker = mode.createWorker(this);
|
||||
else
|
||||
this.$worker = null;
|
||||
|
|
@ -483,52 +524,10 @@ var EditSession = function(text, mode) {
|
|||
return this.doc.insert(position, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param rows Array[Integer] sorted list of rows
|
||||
*/
|
||||
this.multiRowInsert = function(rows, column, text) {
|
||||
for (var i=rows.length-1; i>=0; i--) {
|
||||
var row = rows[i];
|
||||
if (row >= this.doc.getLength())
|
||||
continue;
|
||||
|
||||
var diff = column - this.doc.getLine(row).length;
|
||||
if ( diff > 0) {
|
||||
var padded = lang.stringRepeat(" ", diff) + text;
|
||||
var offset = -diff;
|
||||
}
|
||||
else {
|
||||
padded = text;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
var end = this.insert({row: row, column: column+offset}, padded);
|
||||
}
|
||||
|
||||
return {
|
||||
rows: end ? end.row - rows[0] : 0,
|
||||
columns: end ? end.column - column : 0
|
||||
};
|
||||
};
|
||||
|
||||
this.remove = function(range) {
|
||||
return this.doc.remove(range);
|
||||
};
|
||||
|
||||
this.multiRowRemove = function(rows, range) {
|
||||
if (range.start.row !== rows[0])
|
||||
throw new TypeError("range must start in the first row!");
|
||||
|
||||
var height = range.end.row - rows[0];
|
||||
for (var i=rows.length-1; i>=0; i--) {
|
||||
var row = rows[i];
|
||||
if (row >= this.doc.getLength())
|
||||
continue;
|
||||
|
||||
var end = this.remove(new Range(row, range.start.column, row+height, range.end.column));
|
||||
}
|
||||
};
|
||||
|
||||
this.undoChanges = function(deltas) {
|
||||
if (!deltas.length)
|
||||
return;
|
||||
|
|
@ -576,7 +575,6 @@ var EditSession = function(text, mode) {
|
|||
for (var row=startRow; row<=endRow; row++) {
|
||||
this.insert({row: row, column:0}, indentString);
|
||||
}
|
||||
return indentString.length;
|
||||
};
|
||||
|
||||
this.outdentRows = function (range) {
|
||||
|
|
@ -599,13 +597,8 @@ var EditSession = function(text, mode) {
|
|||
deleteRange.start.column = 0;
|
||||
deleteRange.end.column = j;
|
||||
}
|
||||
if (i == range.start.row)
|
||||
range.start.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
if (i == range.end.row)
|
||||
range.end.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
this.remove(deleteRange);
|
||||
}
|
||||
return range;
|
||||
};
|
||||
|
||||
this.moveLinesUp = function(firstRow, lastRow) {
|
||||
|
|
@ -642,6 +635,10 @@ var EditSession = function(text, mode) {
|
|||
// WRAPMODE
|
||||
this.$wrapLimit = 80;
|
||||
this.$useWrapMode = false;
|
||||
this.$wrapLimitRange = {
|
||||
min : null,
|
||||
max : null
|
||||
};
|
||||
|
||||
this.setUseWrapMode = function(useWrapMode) {
|
||||
if (useWrapMode != this.$useWrapMode) {
|
||||
|
|
@ -651,7 +648,7 @@ var EditSession = function(text, mode) {
|
|||
// If wrapMode is activaed, the wrapData array has to be initialized.
|
||||
if (useWrapMode) {
|
||||
var len = this.getLength();
|
||||
this.$wrapMode = [];
|
||||
this.$wrapData = [];
|
||||
for (i = 0; i < len; i++) {
|
||||
this.$wrapData.push([]);
|
||||
}
|
||||
|
|
@ -666,21 +663,61 @@ var EditSession = function(text, mode) {
|
|||
return this.$useWrapMode;
|
||||
};
|
||||
|
||||
this.setWrapLimit = function(wrapLimit) {
|
||||
if (wrapLimit != this.$wrapLimit) {
|
||||
this.$wrapLimit = wrapLimit;
|
||||
// Allow the wrap limit to move freely between min and max. Either
|
||||
// parameter can be null to allow the wrap limit to be unconstrained
|
||||
// in that direction. Or set both parameters to the same number to pin
|
||||
// the limit to that value.
|
||||
this.setWrapLimitRange = function(min, max) {
|
||||
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
|
||||
this.$wrapLimitRange.min = min;
|
||||
this.$wrapLimitRange.max = max;
|
||||
this.$modified = true;
|
||||
if (this.$useWrapMode) {
|
||||
this.$updateWrapData(0, this.getLength() - 1);
|
||||
}
|
||||
// This will force a recalculation of the wrap limit
|
||||
this._dispatchEvent("changeWrapMode");
|
||||
}
|
||||
};
|
||||
|
||||
// This should generally only be called by the renderer when a resize
|
||||
// is detected.
|
||||
this.adjustWrapLimit = function(desiredLimit) {
|
||||
var wrapLimit = this.$constrainWrapLimit(desiredLimit);
|
||||
if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
|
||||
this.$wrapLimit = wrapLimit;
|
||||
this.$modified = true;
|
||||
if (this.$useWrapMode) {
|
||||
this.$updateWrapData(0, this.getLength() - 1);
|
||||
this._dispatchEvent("changeWrapLimit");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.$constrainWrapLimit = function(wrapLimit) {
|
||||
var min = this.$wrapLimitRange.min;
|
||||
if (min)
|
||||
wrapLimit = Math.max(min, wrapLimit);
|
||||
|
||||
var max = this.$wrapLimitRange.max;
|
||||
if (max)
|
||||
wrapLimit = Math.min(max, wrapLimit);
|
||||
|
||||
// What would a limit of 0 even mean?
|
||||
return Math.max(1, wrapLimit);
|
||||
};
|
||||
|
||||
this.getWrapLimit = function() {
|
||||
return this.$wrapLimit;
|
||||
};
|
||||
|
||||
this.getWrapLimitRange = function() {
|
||||
// Avoid unexpected mutation by returning a copy
|
||||
return {
|
||||
min : this.$wrapLimitRange.min,
|
||||
max : this.$wrapLimitRange.max
|
||||
};
|
||||
};
|
||||
|
||||
this.$updateWrapDataOnChange = function(e) {
|
||||
if (!this.$useWrapMode) {
|
||||
return;
|
||||
|
|
@ -1114,6 +1151,10 @@ var EditSession = function(text, mode) {
|
|||
column: column
|
||||
};
|
||||
}
|
||||
|
||||
var rowData = this.$documentToScreenRow(row, column);
|
||||
var screenRow = rowData[0];
|
||||
|
||||
if (row >= this.getLength()) {
|
||||
return {
|
||||
row: screenRow,
|
||||
|
|
@ -1123,11 +1164,8 @@ var EditSession = function(text, mode) {
|
|||
|
||||
var split;
|
||||
var wrapRowData = this.$wrapData[row];
|
||||
var screenRow, screenRowOffset;
|
||||
var screenColumn;
|
||||
var rowData = this.$documentToScreenRow(row, column);
|
||||
screenRow = rowData[0];
|
||||
screenRowOffset = rowData[1];
|
||||
var screenRowOffset = rowData[1];
|
||||
|
||||
str = this.getLine(row).substring(
|
||||
wrapRowData[screenRowOffset - 1] || 0, column);
|
||||
|
|
@ -1154,4 +1192,4 @@ var EditSession = function(text, mode) {
|
|||
}).call(EditSession.prototype);
|
||||
|
||||
exports.EditSession = EditSession;
|
||||
});
|
||||
});
|
||||
|
|
@ -71,10 +71,7 @@ var Editor =function(renderer, session) {
|
|||
this.$mouseHandler = new MouseHandler(this);
|
||||
}
|
||||
|
||||
this.$selectionMarker = null;
|
||||
this.$highlightLineMarker = null;
|
||||
this.$blockScrolling = false;
|
||||
|
||||
this.$blockScrolling = 0;
|
||||
this.$search = new Search().set({
|
||||
wrap: true
|
||||
});
|
||||
|
|
@ -126,7 +123,10 @@ var Editor =function(renderer, session) {
|
|||
this.session.removeEventListener("change", this.$onDocumentChange);
|
||||
this.session.removeEventListener("changeMode", this.$onDocumentModeChange);
|
||||
this.session.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||
this.session.removeEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||
this.session.removeEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||
this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
||||
this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
|
||||
this.session.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||
this.session.removeEventListener("changeAnnotation", this.$onDocumentChangeAnnotation);
|
||||
|
||||
|
|
@ -149,9 +149,18 @@ var Editor =function(renderer, session) {
|
|||
this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
||||
session.addEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||
|
||||
this.$onDocumentChangeWrapLimit = this.onDocumentChangeWrapLimit.bind(this);
|
||||
session.addEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||
|
||||
this.$onDocumentChangeWrapMode = this.onDocumentChangeWrapMode.bind(this);
|
||||
session.addEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||
|
||||
this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
|
||||
this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
||||
|
||||
this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
|
||||
this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
|
||||
|
||||
this.$onDocumentChangeBreakpoint = this.onDocumentChangeBreakpoint.bind(this);
|
||||
this.session.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||
|
||||
|
|
@ -172,6 +181,8 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCursorChange();
|
||||
this.onSelectionChange();
|
||||
this.onChangeFrontMarker();
|
||||
this.onChangeBackMarker();
|
||||
this.onDocumentChangeBreakpoint();
|
||||
this.onDocumentChangeAnnotation();
|
||||
this.renderer.scrollToRow(session.getScrollTopRow());
|
||||
|
|
@ -208,9 +219,9 @@ var Editor =function(renderer, session) {
|
|||
}
|
||||
|
||||
this.$highlightBrackets = function() {
|
||||
if (this.$bracketHighlight) {
|
||||
this.renderer.removeMarker(this.$bracketHighlight);
|
||||
this.$bracketHighlight = null;
|
||||
if (this.session.$bracketHighlight) {
|
||||
this.session.removeMarker(this.session.$bracketHighlight);
|
||||
this.session.$bracketHighlight = null;
|
||||
}
|
||||
|
||||
if (this.$highlightPending) {
|
||||
|
|
@ -226,7 +237,7 @@ var Editor =function(renderer, session) {
|
|||
var pos = self.session.findMatchingBracket(self.getCursorPosition());
|
||||
if (pos) {
|
||||
var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
|
||||
self.$bracketHighlight = self.renderer.addMarker(range, "ace_bracket");
|
||||
self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket");
|
||||
}
|
||||
}, 10);
|
||||
};
|
||||
|
|
@ -281,7 +292,7 @@ var Editor =function(renderer, session) {
|
|||
this.onCursorChange = function(e) {
|
||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||
|
||||
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
|
||||
if (!this.$blockScrolling) {
|
||||
this.renderer.scrollCursorIntoView();
|
||||
}
|
||||
|
||||
|
|
@ -294,33 +305,48 @@ var Editor =function(renderer, session) {
|
|||
};
|
||||
|
||||
this.$updateHighlightActiveLine = function() {
|
||||
if (this.$highlightLineMarker) {
|
||||
this.renderer.removeMarker(this.$highlightLineMarker);
|
||||
var session = this.getSession();
|
||||
|
||||
if (session.$highlightLineMarker) {
|
||||
session.removeMarker(session.$highlightLineMarker);
|
||||
}
|
||||
this.$highlightLineMarker = null;
|
||||
session.$highlightLineMarker = null;
|
||||
|
||||
if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||
this.$highlightLineMarker = this.renderer.addMarker(range, "ace_active_line", "line");
|
||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line");
|
||||
}
|
||||
};
|
||||
|
||||
this.onSelectionChange = function(e) {
|
||||
if (this.$selectionMarker) {
|
||||
this.renderer.removeMarker(this.$selectionMarker);
|
||||
var session = this.getSession();
|
||||
|
||||
if (session.$selectionMarker) {
|
||||
session.removeMarker(session.$selectionMarker);
|
||||
}
|
||||
this.$selectionMarker = null;
|
||||
session.$selectionMarker = null;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
var range = this.selection.getRange();
|
||||
var style = this.getSelectionStyle();
|
||||
this.$selectionMarker = this.renderer.addMarker(range, "ace_selection", style);
|
||||
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
|
||||
}
|
||||
|
||||
this.onCursorChange(e);
|
||||
|
||||
if (this.$highlightSelectedWord)
|
||||
this.mode.highlightSelection(this);
|
||||
};
|
||||
|
||||
this.onChangeFrontMarker = function() {
|
||||
this.renderer.updateFrontMarkers();
|
||||
};
|
||||
|
||||
this.onChangeBackMarker = function() {
|
||||
this.renderer.updateBackMarkers();
|
||||
};
|
||||
|
||||
this.onDocumentChangeBreakpoint = function() {
|
||||
this.renderer.setBreakpoints(this.session.getBreakpoints());
|
||||
};
|
||||
|
|
@ -348,11 +374,15 @@ var Editor =function(renderer, session) {
|
|||
this.renderer.setTokenizer(this.bgTokenizer);
|
||||
};
|
||||
|
||||
this.onDocumentChangeWrapMode = function() {
|
||||
this.onDocumentChangeWrapLimit = function() {
|
||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||
this.renderer.updateFull();
|
||||
};
|
||||
|
||||
this.onDocumentChangeWrapMode = function() {
|
||||
this.renderer.onResize(true);
|
||||
};
|
||||
|
||||
this.getCopyText = function() {
|
||||
if (!this.selection.isEmpty()) {
|
||||
return this.session.getTextRange(this.getSelectionRange());
|
||||
|
|
@ -367,7 +397,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange())
|
||||
this.clearSelection();
|
||||
}
|
||||
};
|
||||
|
|
@ -397,14 +427,8 @@ var Editor =function(renderer, session) {
|
|||
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
|
||||
var end = this.session.insert(cursor, text);
|
||||
|
||||
/* TODO: This shortcut is somehow broken
|
||||
if (!shouldOutdent && line != this.session.getLine(row) && text != "\n") {
|
||||
this.moveCursorToPosition(end);
|
||||
this.renderer.scrollCursorIntoView();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
this.moveCursorToPosition(end);
|
||||
|
||||
var lineState = this.bgTokenizer.getState(cursor.row);
|
||||
// multi line insert
|
||||
if (cursor.row !== end.row) {
|
||||
|
|
@ -435,17 +459,14 @@ var Editor =function(renderer, session) {
|
|||
outdent -= size;
|
||||
else if (line.charAt(i) == ' ')
|
||||
outdent -= 1;
|
||||
this.session.replace(new Range(row, 0, row, line.length), line.substr(i));
|
||||
this.session.remove(new Range(row, 0, row, i));
|
||||
}
|
||||
end.column += this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||
this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||
} else {
|
||||
if (shouldOutdent) {
|
||||
end.column += this.mode.autoOutdent(lineState, this.session, cursor.row);
|
||||
this.mode.autoOutdent(lineState, this.session, cursor.row);
|
||||
}
|
||||
}
|
||||
|
||||
this.moveCursorToPosition(end);
|
||||
this.renderer.scrollCursorIntoView();
|
||||
};
|
||||
}
|
||||
|
||||
this.onTextInput = function(text) {
|
||||
|
|
@ -462,9 +483,9 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.$overwrite = overwrite;
|
||||
|
||||
this.$blockScrolling = true;
|
||||
this.$blockScrolling += 1;
|
||||
this.onCursorChange();
|
||||
this.$blockScrolling = false;
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
||||
};
|
||||
|
|
@ -510,6 +531,22 @@ var Editor =function(renderer, session) {
|
|||
return this.$highlightActiveLine;
|
||||
};
|
||||
|
||||
this.$highlightSelectedWord = true;
|
||||
this.setHighlightSelectedWord = function(shouldHighlight) {
|
||||
if (this.$highlightSelectedWord == shouldHighlight)
|
||||
return;
|
||||
|
||||
this.$highlightSelectedWord = shouldHighlight;
|
||||
if (shouldHighlight)
|
||||
this.mode.highlightSelection(this);
|
||||
else
|
||||
this.mode.clearSelectionHighlight(this);
|
||||
};
|
||||
|
||||
this.getHighlightSelectedWord = function() {
|
||||
return this.$highlightSelectedWord;
|
||||
};
|
||||
|
||||
this.setShowInvisibles = function(showInvisibles) {
|
||||
if (this.getShowInvisibles() == showInvisibles)
|
||||
return;
|
||||
|
|
@ -553,7 +590,7 @@ var Editor =function(renderer, session) {
|
|||
if (this.selection.isEmpty()) {
|
||||
this.selection.selectRight();
|
||||
}
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange())
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
|
|
@ -564,10 +601,93 @@ var Editor =function(renderer, session) {
|
|||
if (this.selection.isEmpty())
|
||||
this.selection.selectLeft();
|
||||
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeWordRight = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordRight();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeWordLeft = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordLeft();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeToLineStart = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineStart();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeToLineEnd = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineEnd();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.splitLine = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
}
|
||||
|
||||
var cursor = this.getCursorPosition();
|
||||
this.insert("\n");
|
||||
this.moveCursorToPosition(cursor);
|
||||
};
|
||||
|
||||
this.transposeLetters = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cursor = this.getCursorPosition();
|
||||
var column = cursor.column;
|
||||
if (column == 0)
|
||||
return;
|
||||
|
||||
var line = this.session.getLine(cursor.row);
|
||||
if (column < line.length) {
|
||||
var swap = line.charAt(column) + line.charAt(column-1);
|
||||
var range = new Range(cursor.row, column-1, cursor.row, column+1)
|
||||
}
|
||||
else {
|
||||
var swap = line.charAt(column-1) + line.charAt(column-2);
|
||||
var range = new Range(cursor.row, column-2, cursor.row, column)
|
||||
}
|
||||
this.session.replace(range, swap);
|
||||
};
|
||||
|
||||
this.indent = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
|
@ -577,9 +697,7 @@ var Editor =function(renderer, session) {
|
|||
|
||||
if (range.start.row < range.end.row || range.start.column < range.end.column) {
|
||||
var rows = this.$getSelectedRows();
|
||||
var count = session.indentRows(rows.first, rows.last, "\t");
|
||||
|
||||
this.selection.shiftSelection(count);
|
||||
session.indentRows(rows.first, rows.last, "\t");
|
||||
} else {
|
||||
var indentString;
|
||||
|
||||
|
|
@ -601,9 +719,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
var selection = this.session.getSelection();
|
||||
var range = this.session.outdentRows(selection.getRange());
|
||||
|
||||
selection.setSelectionRange(range, selection.isBackwards());
|
||||
this.session.outdentRows(selection.getRange());
|
||||
};
|
||||
|
||||
this.toggleCommentLines = function() {
|
||||
|
|
@ -612,8 +728,7 @@ var Editor =function(renderer, session) {
|
|||
|
||||
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
||||
var rows = this.$getSelectedRows()
|
||||
var addedColumns = this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||
this.selection.shiftSelection(addedColumns);
|
||||
this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||
};
|
||||
|
||||
this.removeLines = function() {
|
||||
|
|
@ -621,10 +736,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
var rows = this.$getSelectedRows();
|
||||
this.selection.setSelectionAnchor(rows.last+1, 0);
|
||||
this.selection.selectTo(rows.first, 0);
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.session.remove(new Range(rows.first, 0, rows.last+1, 0));
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
|
|
@ -689,7 +801,6 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCompositionStart = function(text) {
|
||||
this.renderer.showComposition(this.getCursorPosition());
|
||||
//this.onTextInput(text);
|
||||
};
|
||||
|
||||
this.onCompositionUpdate = function(text) {
|
||||
|
|
@ -698,7 +809,6 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCompositionEnd = function() {
|
||||
this.renderer.hideComposition();
|
||||
//this.removeLeft();
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -714,83 +824,101 @@ var Editor =function(renderer, session) {
|
|||
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
||||
};
|
||||
|
||||
this.getVisibleRowCount = function() {
|
||||
return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1;
|
||||
this.$getVisibleRowCount = function() {
|
||||
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
|
||||
};
|
||||
|
||||
this.getPageDownRow = function() {
|
||||
return this.renderer.getLastVisibleRow() - 1;
|
||||
this.$getPageDownRow = function() {
|
||||
return this.renderer.getScrollBottomRow();
|
||||
};
|
||||
|
||||
this.getPageUpRow = function() {
|
||||
var firstRow = this.renderer.getFirstVisibleRow();
|
||||
var lastRow = this.renderer.getLastVisibleRow();
|
||||
this.$getPageUpRow = function() {
|
||||
var firstRow = this.renderer.getScrollTopRow();
|
||||
var lastRow = this.renderer.getScrollBottomRow();
|
||||
|
||||
return firstRow - (lastRow - firstRow) + 1;
|
||||
return firstRow - (lastRow - firstRow);
|
||||
};
|
||||
|
||||
this.selectPageDown = function() {
|
||||
var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2);
|
||||
var row = this.$getPageDownRow() + Math.floor(this.$getVisibleRowCount() / 2);
|
||||
|
||||
this.scrollPageDown();
|
||||
|
||||
var selection = this.getSelection();
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(row, selection.getSelectionLead().column);
|
||||
});
|
||||
var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
|
||||
var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
|
||||
selection.selectTo(dest.row, dest.column);
|
||||
};
|
||||
|
||||
this.selectPageUp = function() {
|
||||
var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow();
|
||||
var row = this.getPageUpRow() + Math.round(visibleRows / 2);
|
||||
var visibleRows = this.renderer.getScrollTopRow() - this.renderer.getScrollBottomRow();
|
||||
var row = this.$getPageUpRow() + Math.round(visibleRows / 2);
|
||||
|
||||
this.scrollPageUp();
|
||||
|
||||
var selection = this.getSelection();
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(row, selection.getSelectionLead().column);
|
||||
});
|
||||
var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
|
||||
var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
|
||||
selection.selectTo(dest.row, dest.column);
|
||||
};
|
||||
|
||||
this.gotoPageDown = function() {
|
||||
var row = this.getPageDownRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.session.getLine(row).length);
|
||||
var row = this.$getPageDownRow();
|
||||
var column = this.getCursorPositionScreen().column;
|
||||
|
||||
this.scrollToRow(row);
|
||||
this.getSelection().moveCursorTo(row, column);
|
||||
this.getSelection().moveCursorToScreen(row, column);
|
||||
};
|
||||
|
||||
this.gotoPageUp = function() {
|
||||
var row = this.getPageUpRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.session.getLine(row).length);
|
||||
var row = this.$getPageUpRow();
|
||||
var column = this.getCursorPositionScreen().column;
|
||||
|
||||
this.scrollToRow(row);
|
||||
this.getSelection().moveCursorTo(row, column);
|
||||
this.getSelection().moveCursorToScreen(row, column);
|
||||
};
|
||||
|
||||
this.scrollPageDown = function() {
|
||||
this.scrollToRow(this.getPageDownRow());
|
||||
this.scrollToRow(this.$getPageDownRow());
|
||||
};
|
||||
|
||||
this.scrollPageUp = function() {
|
||||
this.renderer.scrollToRow(this.getPageUpRow());
|
||||
this.renderer.scrollToRow(this.$getPageUpRow());
|
||||
};
|
||||
|
||||
this.scrollToRow = function(row) {
|
||||
this.renderer.scrollToRow(row);
|
||||
};
|
||||
|
||||
this.scrollToLine = function(line, center) {
|
||||
this.renderer.scrollToLine(line, center);
|
||||
};
|
||||
|
||||
this.centerSelection = function() {
|
||||
var range = this.getSelectionRange();
|
||||
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
|
||||
this.renderer.scrollToLine(line, true);
|
||||
};
|
||||
|
||||
this.getCursorPosition = function() {
|
||||
return this.selection.getCursor();
|
||||
};
|
||||
|
||||
this.getCursorPositionScreen = function() {
|
||||
return this.session.documentToScreenPosition(this.getCursorPosition());
|
||||
}
|
||||
|
||||
this.getSelectionRange = function() {
|
||||
return this.selection.getRange();
|
||||
};
|
||||
|
||||
|
||||
this.selectAll = function() {
|
||||
this.$blockScrolling += 1;
|
||||
this.selection.selectAll();
|
||||
this.$blockScrolling -= 1;
|
||||
};
|
||||
|
||||
this.clearSelection = function() {
|
||||
this.selection.clearSelection();
|
||||
};
|
||||
|
|
@ -807,12 +935,12 @@ var Editor =function(renderer, session) {
|
|||
this.gotoLine = function(lineNumber, row) {
|
||||
this.selection.clearSelection();
|
||||
|
||||
this.$blockScrolling = true;
|
||||
this.$blockScrolling += 1;
|
||||
this.moveCursorTo(lineNumber-1, row || 0);
|
||||
this.$blockScrolling = false;
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));
|
||||
this.scrollToLine(lineNumber, true);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -910,13 +1038,16 @@ var Editor =function(renderer, session) {
|
|||
if (!ranges.length)
|
||||
return;
|
||||
|
||||
var selection = this.getSelectionRange();
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
for (var i = ranges.length - 1; i >= 0; --i)
|
||||
this.$tryReplace(ranges[i], replacement);
|
||||
if (ranges[0] !== null)
|
||||
this.selection.setSelectionRange(ranges[0]);
|
||||
|
||||
this.selection.setSelectionRange(selection);
|
||||
this.$blockScrolling -= 1;
|
||||
},
|
||||
|
||||
this.$tryReplace = function(range, replacement) {
|
||||
|
|
|
|||
|
|
@ -54,37 +54,44 @@ exports.bindings = {
|
|||
"selecttostart": "Command-Shift-Up",
|
||||
"gotostart": "Command-Home|Command-Up",
|
||||
"selectup": "Shift-Up",
|
||||
"golineup": "Up",
|
||||
"golineup": "Up|Ctrl-P",
|
||||
"copylinesdown": "Command-Option-Down",
|
||||
"movelinesdown": "Option-Down",
|
||||
"selecttoend": "Command-Shift-Down",
|
||||
"gotoend": "Command-End|Command-Down",
|
||||
"selectdown": "Shift-Down",
|
||||
"golinedown": "Down",
|
||||
"golinedown": "Down|Ctrl-N",
|
||||
"selectwordleft": "Option-Shift-Left",
|
||||
"gotowordleft": "Option-Left",
|
||||
"selecttolinestart": "Command-Shift-Left",
|
||||
"gotolinestart": "Command-Left|Home",
|
||||
"gotolinestart": "Command-Left|Home|Ctrl-A",
|
||||
"selectleft": "Shift-Left",
|
||||
"gotoleft": "Left",
|
||||
"gotoleft": "Left|Ctrl-B",
|
||||
"selectwordright": "Option-Shift-Right",
|
||||
"gotowordright": "Option-Right",
|
||||
"selecttolineend": "Command-Shift-Right",
|
||||
"gotolineend": "Command-Right|End",
|
||||
"gotolineend": "Command-Right|End|Ctrl-E",
|
||||
"selectright": "Shift-Right",
|
||||
"gotoright": "Right",
|
||||
"gotoright": "Right|Ctrl-F",
|
||||
"selectpagedown": "Shift-PageDown",
|
||||
"pagedown": "PageDown",
|
||||
"gotopagedown": "Option-PageDown",
|
||||
"gotopagedown": "Option-PageDown|Ctrl-V",
|
||||
"selectpageup": "Shift-PageUp",
|
||||
"pageup": "PageUp",
|
||||
"gotopageup": "Option-PageUp",
|
||||
"selectlinestart": "Shift-Home",
|
||||
"selectlineend": "Shift-End",
|
||||
"del": "Delete",
|
||||
"backspace": "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"del": "Delete|Ctrl-D",
|
||||
"backspace": "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H",
|
||||
"removetolineend": "Ctrl-K",
|
||||
"removetolinestart": "Option-Backspace",
|
||||
"removewordleft": "Alt-Backspace|Ctrl-Alt-Backspace",
|
||||
"removewordright": "Alt-Delete",
|
||||
"outdent": "Shift-Tab",
|
||||
"indent": "Tab"
|
||||
"indent": "Tab",
|
||||
"transposeletters": "Ctrl-T",
|
||||
"splitline": "Ctrl-O",
|
||||
"centerselection": "Ctrl-L"
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -197,7 +197,7 @@ StateHandler.prototype = {
|
|||
// If we pressed any command key but no other key, then ignore the input.
|
||||
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
|
||||
// which results in "shift-shift-g" which doesn't make senese.
|
||||
if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
|
||||
if (hashId != 0 && (key == "" || String.fromCharCode(0))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
|
|
@ -129,7 +128,6 @@ var TextInput = function(parentNode, host) {
|
|||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
|
|
@ -163,8 +161,29 @@ var TextInput = function(parentNode, host) {
|
|||
event.addListener(text, "propertychange", onTextInput);
|
||||
};
|
||||
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
if (useragent.isIE) {
|
||||
event.addListener(text, "beforecopy", function(e) {
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
clipboardData.setData("Text", copyText);
|
||||
else
|
||||
e.preventDefault();
|
||||
});
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 88) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
clipboardData.setData("Text", copyText);
|
||||
host.onCut();
|
||||
}
|
||||
event.preventDefault(e)
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
}
|
||||
|
||||
event.addListener(text, "compositionstart", onCompositionStart);
|
||||
if (useragent.isGecko) {
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@ var Marker = function(parentEl) {
|
|||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_layer ace_marker-layer";
|
||||
parentEl.appendChild(this.element);
|
||||
|
||||
this.markers = {};
|
||||
this.$markerId = 1;
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -55,23 +52,9 @@ var Marker = function(parentEl) {
|
|||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
};
|
||||
|
||||
this.addMarker = function(range, clazz, type) {
|
||||
var id = this.$markerId++;
|
||||
this.markers[id] = {
|
||||
range : range,
|
||||
type : type || "line",
|
||||
clazz : clazz
|
||||
};
|
||||
|
||||
return id;
|
||||
};
|
||||
|
||||
this.removeMarker = function(markerId) {
|
||||
var marker = this.markers[markerId];
|
||||
if (marker) {
|
||||
delete (this.markers[markerId]);
|
||||
}
|
||||
|
||||
this.setMarkers = function(markers) {
|
||||
this.markers = markers;
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
|
|
@ -81,7 +64,7 @@ var Marker = function(parentEl) {
|
|||
|
||||
this.config = config;
|
||||
|
||||
var html = [];
|
||||
var html = [];
|
||||
for ( var key in this.markers) {
|
||||
var marker = this.markers[key];
|
||||
|
||||
|
|
@ -90,7 +73,12 @@ var Marker = function(parentEl) {
|
|||
|
||||
range = range.toScreenRange(this.session);
|
||||
|
||||
if (range.isMultiLine()) {
|
||||
if (marker.renderer) {
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var left = Math.round(range.start.column * config.characterWidth);
|
||||
marker.renderer(html, range, left, top, config);
|
||||
}
|
||||
else if (range.isMultiLine()) {
|
||||
if (marker.type == "text") {
|
||||
this.drawTextMarker(html, range, marker.clazz, config);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ var Text = function(parentEl) {
|
|||
var style = measureNode.style;
|
||||
|
||||
style.width = style.height = "auto";
|
||||
style.left = style.top = "-1000px";
|
||||
style.left = style.top = (-n * 40) + "px";
|
||||
|
||||
style.visibility = "hidden";
|
||||
style.position = "absolute";
|
||||
|
|
|
|||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
|||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "//");
|
||||
doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var lang = require("pilot/lang");
|
|||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
c_cppHighlightRules = function() {
|
||||
var c_cppHighlightRules = function() {
|
||||
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
|
|
|
|||
|
|
@ -37,52 +37,63 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer
|
||||
, Rules = require("ace/mode/coffee_highlight_rules").CoffeeHighlightRules
|
||||
, Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent
|
||||
, Range = require("ace/range").Range
|
||||
;
|
||||
require("pilot/oop").inherits(CoffeeMode, require("ace/mode/text").Mode);
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var Rules = require("ace/mode/coffee_highlight_rules").CoffeeHighlightRules;
|
||||
var Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var oop = require("pilot/oop")
|
||||
|
||||
function CoffeeMode() {
|
||||
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
||||
this.$outdent = new Outdent();
|
||||
}
|
||||
var proto = CoffeeMode.prototype
|
||||
, indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/
|
||||
, commentLine = /^(\s*)#/
|
||||
, hereComment = /^\s*###(?!#)/
|
||||
, indentation = /^\s*/
|
||||
;
|
||||
proto.getNextLineIndent = function(state, line, tab){
|
||||
var indent = this.$getIndent(line)
|
||||
, tokens = this.$tokenizer.getLineTokens(line, state).tokens
|
||||
;
|
||||
};
|
||||
|
||||
oop.inherits(CoffeeMode, TextMode);
|
||||
|
||||
var proto = CoffeeMode.prototype;
|
||||
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
|
||||
var commentLine = /^(\s*)#/;
|
||||
var hereComment = /^\s*###(?!#)/;
|
||||
var indentation = /^\s*/;
|
||||
|
||||
proto.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||
|
||||
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||
state === 'start' && indenter.test(line))
|
||||
indent += tab;
|
||||
return indent;
|
||||
};
|
||||
|
||||
proto.toggleCommentLines = function(state, doc, startRow, endRow){
|
||||
var out, range = new Range(0, 0, 0, 0);
|
||||
console.log("toggle");
|
||||
var range = new Range(0, 0, 0, 0);
|
||||
for (var i = startRow; i <= endRow; ++i) {
|
||||
var line = doc.getLine(i);
|
||||
if (hereComment.test(line)) continue;
|
||||
line = (out = commentLine.test(line))
|
||||
? line.replace(commentLine, '$1')
|
||||
: line.replace(indentation, '$&#');
|
||||
if (hereComment.test(line))
|
||||
continue;
|
||||
|
||||
if (commentLine.test(line))
|
||||
line = line.replace(commentLine, '$1');
|
||||
else
|
||||
line = line.replace(indentation, '$&#');
|
||||
|
||||
range.end.row = range.start.row = i;
|
||||
range.end.column = line.length + 1;
|
||||
doc.replace(range, line);
|
||||
}
|
||||
return 1 - out * 2;
|
||||
};
|
||||
|
||||
proto.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
proto.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
exports.Mode = CoffeeMode;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -73,7 +73,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ oop.inherits(Mode, TextMode);
|
|||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
return this.$delegate("toggleCommentLines", arguments, function() {
|
||||
this.$delegate("toggleCommentLines", arguments, function() {
|
||||
return 0;
|
||||
});
|
||||
};
|
||||
|
|
@ -74,7 +74,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$delegate("autoOutdent", arguments);
|
||||
this.$delegate("autoOutdent", arguments);
|
||||
};
|
||||
|
||||
this.$delegate = function(method, args, defaultHandler) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var lang = require("pilot/lang");
|
|||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
JavaHighlightRules = function() {
|
||||
var JavaHighlightRules = function() {
|
||||
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ JavaHighlightRules = function() {
|
|||
"class|finally|long|strictfp|volatile|" +
|
||||
"const|float|native|super|while").split("|")
|
||||
);
|
||||
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("null|Infinity|NaN|undefined").split("|")
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
|||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "//");
|
||||
doc.indentRows(startRow, endRow, "//");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var lang = require("pilot/lang");
|
|||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
JavaScriptHighlightRules = function() {
|
||||
var JavaScriptHighlightRules = function() {
|
||||
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
|
|
@ -50,11 +50,11 @@ JavaScriptHighlightRules = function() {
|
|||
("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
||||
"if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with").split("|")
|
||||
);
|
||||
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("null|Infinity|NaN|undefined").split("|")
|
||||
);
|
||||
|
||||
|
||||
var futureReserved = lang.arrayToMap(
|
||||
("class|enum|extends|super|const|export|import|implements|let|private|" +
|
||||
"public|yield|interface|package|protected|static").split("|")
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ var MatchingBraceOutdent = function() {};
|
|||
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
|
||||
return indent.length - (column-1);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
|
|
|
|||
116
lib/ace/mode/perl.js
Normal file
116
lib/ace/mode/perl.js
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Panagiotis Astithas <pastith AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var PerlHighlightRules = require("ace/mode/perl_highlight_rules").PerlHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new PerlHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
var outdent = true;
|
||||
var outentedRows = [];
|
||||
var re = /^(\s*)#/;
|
||||
|
||||
for (var i=startRow; i<= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (outdent) {
|
||||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
doc.indentRows(startRow, endRow, "#");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[\:]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
|
||||
return indent;
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
163
lib/ace/mode/perl_highlight_rules.js
Normal file
163
lib/ace/mode/perl_highlight_rules.js
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Panagiotis Astithas <pastith AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var PerlHighlightRules = function() {
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
|
||||
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("ARGV|ENV|INC|SIG").split("|")
|
||||
);
|
||||
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
|
||||
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
|
||||
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
|
||||
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
|
||||
"getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
|
||||
"localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
|
||||
"closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
|
||||
"shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
|
||||
"dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
|
||||
"setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
|
||||
"lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
|
||||
"waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
|
||||
"chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
|
||||
"unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
|
||||
"length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
|
||||
"undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
|
||||
"sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
|
||||
"BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
|
||||
"join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
|
||||
"keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
|
||||
"eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
|
||||
"map|die|uc|lc|do").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
}, {
|
||||
token : "string.regexp",
|
||||
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : '["].*\\\\$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||
}, {
|
||||
token : "string", // multi line string start
|
||||
regex : "['].*\\\\$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0x[0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : function(value) {
|
||||
if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else if (builtinFunctions.hasOwnProperty(value))
|
||||
return "support.function";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
|
||||
}, {
|
||||
token : "lparen",
|
||||
regex : "[[({]"
|
||||
}, {
|
||||
token : "rparen",
|
||||
regex : "[\\])}]"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
}
|
||||
],
|
||||
"qqstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
token : "string",
|
||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(PerlHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.PerlHighlightRules = PerlHighlightRules;
|
||||
});
|
||||
|
|
@ -68,16 +68,16 @@ oop.inherits(Mode, TextMode);
|
|||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "#");
|
||||
doc.indentRows(startRow, endRow, "#");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
|
@ -43,7 +43,7 @@ var lang = require("pilot/lang");
|
|||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
PhpHighlightRules = function() {
|
||||
var PhpHighlightRules = function() {
|
||||
|
||||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
|
|
@ -443,18 +443,18 @@ PhpHighlightRules = function() {
|
|||
'include|include_once|global|goto|if|implements|interface|instanceof|namespace|new|old_function|or|' +
|
||||
'private|protected|public|return|require|require_once|static|switch|throw|try|use|var|while|xor').split('|')
|
||||
);
|
||||
|
||||
|
||||
var builtinConstants = lang.arrayToMap(
|
||||
('true|false|null|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__CLASS__').split('|')
|
||||
);
|
||||
|
||||
|
||||
var builtinVariables = lang.arrayToMap(
|
||||
('$_GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|' +
|
||||
'$http_response_header|$argc|$argv').split('|')
|
||||
);
|
||||
|
||||
|
||||
var futureReserved = lang.arrayToMap([]);
|
||||
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
|
|
@ -472,6 +472,10 @@ PhpHighlightRules = function() {
|
|||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
{
|
||||
token : "comment",
|
||||
regex : "#.*$"
|
||||
},
|
||||
docComment.getStartRule("doc-start"),
|
||||
{
|
||||
token : "comment", // multi line comment
|
||||
|
|
@ -503,13 +507,13 @@ PhpHighlightRules = function() {
|
|||
}, {
|
||||
token : "constant.language", // constants
|
||||
regex : "\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|" +
|
||||
"ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|" +
|
||||
"HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|" +
|
||||
"ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|" +
|
||||
"HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|" +
|
||||
"L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|" +
|
||||
"VERSION))|__COMPILER_HALT_OFFSET__)\\b"
|
||||
}, {
|
||||
token : "constant.language", // constants
|
||||
regex : "\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|" +
|
||||
regex : "\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|" +
|
||||
"SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|" +
|
||||
"O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|" +
|
||||
"R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|" +
|
||||
|
|
|
|||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
|||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "#");
|
||||
doc.indentRows(startRow, endRow, "#");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var oop = require("pilot/oop");
|
|||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
PythonHighlightRules = function() {
|
||||
var PythonHighlightRules = function() {
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
|
||||
|
|
@ -72,7 +72,7 @@ PythonHighlightRules = function() {
|
|||
("").split("|")
|
||||
);
|
||||
|
||||
var strPre = "(?:(?:[rubRUB])|(?:[ubUB][rR]))?";
|
||||
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||
|
||||
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||
|
|
@ -93,24 +93,24 @@ PythonHighlightRules = function() {
|
|||
regex : "#.*$"
|
||||
}, {
|
||||
token : "string", // """ string
|
||||
regex : strPre + '"{3}(?:(?:.)|(?:^"{3}))*?"{3}'
|
||||
regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}'
|
||||
}, {
|
||||
token : "string", // multi line """ string start
|
||||
regex : strPre + '"{3}.*$',
|
||||
next : "qqstring"
|
||||
}, {
|
||||
token : "string", // " string
|
||||
regex : strPre + '"(?:(?:\\\\.)|(?:[^"\\\\]))*?"'
|
||||
regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
|
||||
}, {
|
||||
token : "string", // ''' string
|
||||
regex : strPre + "'{3}(?:(?:.)|(?:^'{3}))*?'{3}"
|
||||
regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}"
|
||||
}, {
|
||||
token : "string", // multi line ''' string start
|
||||
regex : strPre + "'{3}.*$",
|
||||
next : "qstring"
|
||||
}, {
|
||||
token : "string", // ' string
|
||||
regex : strPre + "'(?:(?:\\\\.)|(?:[^'\\\\]))*?'"
|
||||
regex : strPre + "'(?:[^\\\\]|\\\\.)*?'"
|
||||
}, {
|
||||
token : "constant.numeric", // imaginary
|
||||
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||
|
|
@ -153,8 +153,8 @@ PythonHighlightRules = function() {
|
|||
regex : "\\s+"
|
||||
} ],
|
||||
"qqstring" : [ {
|
||||
token : "string", // multi line """ string end
|
||||
regex : '(?:^"{3})*?"{3}',
|
||||
token : "string", // multi line """ string end
|
||||
regex : '(?:[^\\\\]|\\\\.)*?"{3}',
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
|
|
@ -162,7 +162,7 @@ PythonHighlightRules = function() {
|
|||
} ],
|
||||
"qstring" : [ {
|
||||
token : "string", // multi line ''' string end
|
||||
regex : "(?:^'{3})*?'{3}",
|
||||
regex : "(?:[^\\\\]|\\\\.)*?'{3}",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
|
|
|
|||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
|||
var deleteRange = new Range(0, 0, 0, 0);
|
||||
for (var i=startRow; i<= endRow; i++)
|
||||
{
|
||||
var line = doc.getLine(i).replace(re, "$1");
|
||||
var line = doc.getLine(i);
|
||||
var m = line.match(re);
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
deleteRange.end.column = line.length + 2;
|
||||
doc.replace(deleteRange, line);
|
||||
deleteRange.end.column = m[0].length;
|
||||
doc.replace(deleteRange, m[1]);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
else {
|
||||
return doc.indentRows(startRow, endRow, "#");
|
||||
doc.indentRows(startRow, endRow, "#");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ oop.inherits(Mode, TextMode);
|
|||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
return this.$outdent.autoOutdent(doc, row);
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var oop = require("pilot/oop");
|
|||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
|
||||
RubyHighlightRules = function() {
|
||||
var RubyHighlightRules = function() {
|
||||
|
||||
var builtinFunctions = lang.arrayToMap(
|
||||
("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!" +
|
||||
|
|
@ -56,7 +56,7 @@ RubyHighlightRules = function() {
|
|||
("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|" +
|
||||
"if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield").split("|")
|
||||
);
|
||||
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|")
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
|
@ -20,6 +21,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -51,7 +53,6 @@ var Mode = function() {
|
|||
};
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
|
|
@ -78,6 +79,64 @@ var Mode = function() {
|
|||
return null;
|
||||
};
|
||||
|
||||
this.highlightSelection = function(editor) {
|
||||
var session = editor.session;
|
||||
if (!session.$selectionOccurrences)
|
||||
session.$selectionOccurrences = [];
|
||||
|
||||
if (session.$selectionOccurrences.length)
|
||||
this.clearSelectionHighlight(editor);
|
||||
|
||||
var selection = editor.getSelectionRange();
|
||||
if (selection.isEmpty() || selection.isMultiLine())
|
||||
return;
|
||||
|
||||
var startOuter = selection.start.column - 1;
|
||||
var endOuter = selection.end.column + 1;
|
||||
var line = session.getLine(selection.start.row);
|
||||
var lineCols = line.length - 1;
|
||||
var needle = line.substring(Math.max(startOuter, 0),
|
||||
Math.min(endOuter, lineCols));
|
||||
|
||||
// Make sure the outer characters are not part of the word.
|
||||
if ((startOuter >= 0 && !/[^\w\d]/.test(needle.charAt(0))) ||
|
||||
(endOuter <= lineCols && !/[^\w\d]/.test(needle.charAt(needle.length - 1))))
|
||||
return;
|
||||
|
||||
needle = line.substring(selection.start.column, selection.end.column);
|
||||
if (!/^[\w\d]+$/.test(needle))
|
||||
return;
|
||||
|
||||
var newOptions = {
|
||||
wrap: true,
|
||||
wholeWord: true,
|
||||
needle: needle
|
||||
};
|
||||
|
||||
var currentOptions = editor.$search.getOptions();
|
||||
editor.$search.set(newOptions);
|
||||
|
||||
var ranges = editor.$search.findAll(session);
|
||||
session.$selectionOccurrences = [];
|
||||
ranges.forEach(function(range) {
|
||||
if (!range.contains(selection.start.row, selection.start.column)) {
|
||||
var marker = session.addMarker(range, "ace_selected_word");
|
||||
session.$selectionOccurrences.push(marker);
|
||||
}
|
||||
});
|
||||
|
||||
editor.$search.set(currentOptions);
|
||||
};
|
||||
|
||||
this.clearSelectionHighlight = function(editor) {
|
||||
if (!editor.session.$selectionOccurrences)
|
||||
return;
|
||||
|
||||
editor.session.$selectionOccurrences.forEach(function(marker) {
|
||||
editor.session.removeMarker(marker);
|
||||
});
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var TextHighlightRules = function() {
|
|||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "empty_line",
|
||||
regex : '^$',
|
||||
regex : '^$'
|
||||
}, {
|
||||
token : "text",
|
||||
regex : ".+"
|
||||
|
|
|
|||
|
|
@ -165,4 +165,4 @@ var MouseHandler = function(editor) {
|
|||
}).call(MouseHandler.prototype);
|
||||
|
||||
exports.MouseHandler = MouseHandler;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -42,15 +42,29 @@ var oop = require("pilot/oop");
|
|||
var lang = require("pilot/lang");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Range = require("ace/range").Range;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
|
||||
var Selection = function(doc) {
|
||||
this.doc = doc;
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
||||
this.clearSelection();
|
||||
this.selectionLead = {
|
||||
row: 0,
|
||||
column: 0
|
||||
};
|
||||
this.selectionLead = new Anchor(this.doc, 0, 0);
|
||||
this.selectionAnchor = new Anchor(this.doc, 0, 0);
|
||||
|
||||
var _self = this;
|
||||
this.selectionLead.on("change", function(e) {
|
||||
_self._dispatchEvent("changeCursor");
|
||||
if (!_self.$isEmpty)
|
||||
_self._dispatchEvent("changeSelection");
|
||||
if (e.old.row == e.value.row)
|
||||
_self.$updateDesiredColumn();
|
||||
});
|
||||
|
||||
this.selectionAnchor.on("change", function() {
|
||||
if (!_self.$isEmpty)
|
||||
_self._dispatchEvent("changeSelection");
|
||||
});
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -58,9 +72,10 @@ var Selection = function(doc) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isEmpty = function() {
|
||||
return (!this.selectionAnchor ||
|
||||
(this.selectionAnchor.row == this.selectionLead.row &&
|
||||
this.selectionAnchor.column == this.selectionLead.column));
|
||||
return (this.$isEmpty || (
|
||||
this.selectionAnchor.row == this.selectionLead.row &&
|
||||
this.selectionAnchor.column == this.selectionLead.column
|
||||
));
|
||||
};
|
||||
|
||||
this.isMultiLine = function() {
|
||||
|
|
@ -72,37 +87,31 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.getCursor = function() {
|
||||
return this.selectionLead;
|
||||
return this.selectionLead.getPosition();
|
||||
};
|
||||
|
||||
this.setSelectionAnchor = function(row, column) {
|
||||
var anchor = this.$clipPositionToDocument(row, column);
|
||||
this.selectionAnchor.setPosition(row, column);
|
||||
|
||||
if (!this.selectionAnchor) {
|
||||
this.selectionAnchor = anchor;
|
||||
this._dispatchEvent("changeSelection", {});
|
||||
if (this.$isEmpty) {
|
||||
this.$isEmpty = false;
|
||||
this._dispatchEvent("changeSelection");
|
||||
}
|
||||
else if (this.selectionAnchor.row !== anchor.row || this.selectionAnchor.column !== anchor.column) {
|
||||
this.selectionAnchor = anchor;
|
||||
this._dispatchEvent("changeSelection", {});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.getSelectionAnchor = function() {
|
||||
if (this.selectionAnchor) {
|
||||
return this.$clone(this.selectionAnchor);
|
||||
} else {
|
||||
return this.$clone(this.selectionLead);
|
||||
}
|
||||
if (this.$isEmpty)
|
||||
return this.getSelectionLead()
|
||||
else
|
||||
return this.selectionAnchor.getPosition();
|
||||
};
|
||||
|
||||
this.getSelectionLead = function() {
|
||||
return this.$clone(this.selectionLead);
|
||||
return this.selectionLead.getPosition();
|
||||
};
|
||||
|
||||
this.shiftSelection = function(columns) {
|
||||
if (this.isEmpty()) {
|
||||
if (this.$isEmpty) {
|
||||
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
||||
return;
|
||||
};
|
||||
|
|
@ -123,15 +132,18 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.isBackwards = function() {
|
||||
var anchor = this.selectionAnchor || this.selectionLead;
|
||||
var anchor = this.selectionAnchor;
|
||||
var lead = this.selectionLead;
|
||||
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
|
||||
};
|
||||
|
||||
this.getRange = function() {
|
||||
var anchor = this.selectionAnchor || this.selectionLead;
|
||||
var anchor = this.selectionAnchor;
|
||||
var lead = this.selectionLead;
|
||||
|
||||
if (this.isEmpty())
|
||||
return Range.fromPoints(lead, lead);
|
||||
|
||||
if (this.isBackwards()) {
|
||||
return Range.fromPoints(lead, anchor);
|
||||
}
|
||||
|
|
@ -141,26 +153,16 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.clearSelection = function() {
|
||||
if (this.selectionAnchor) {
|
||||
this.selectionAnchor = null;
|
||||
this._dispatchEvent("changeSelection", {});
|
||||
if (!this.$isEmpty) {
|
||||
this.$isEmpty = true;
|
||||
this._dispatchEvent("changeSelection");
|
||||
}
|
||||
};
|
||||
|
||||
this.selectAll = function() {
|
||||
var lastRow = this.doc.getLength() - 1;
|
||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||
|
||||
if (!this.selectionAnchor) {
|
||||
this.selectionAnchor = this.$clone(this.selectionLead);
|
||||
}
|
||||
|
||||
var cursor = {row:0, column:0};
|
||||
// only dispatch change if the cursor actually changed
|
||||
if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) {
|
||||
this.selectionLead = cursor;
|
||||
this._dispatchEvent("changeSelection", {blockScrolling: true});
|
||||
}
|
||||
this.moveCursorTo(0, 0);
|
||||
};
|
||||
|
||||
this.setSelectionRange = function(range, reverse) {
|
||||
|
|
@ -176,28 +178,15 @@ var Selection = function(doc) {
|
|||
|
||||
this.$updateDesiredColumn = function() {
|
||||
var cursor = this.getCursor();
|
||||
if (cursor) {
|
||||
this.$desiredColumn = this.doc.documentToScreenColumn(cursor.row, cursor.column);
|
||||
}
|
||||
this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
|
||||
};
|
||||
|
||||
this.$moveSelection = function(mover) {
|
||||
var changed = false;
|
||||
var lead = this.selectionLead;
|
||||
if (this.$isEmpty)
|
||||
this.setSelectionAnchor(lead.row, lead.column);
|
||||
|
||||
if (!this.selectionAnchor) {
|
||||
changed = true;
|
||||
this.selectionAnchor = this.$clone(this.selectionLead);
|
||||
}
|
||||
|
||||
var cursor = this.$clone(this.selectionLead);
|
||||
mover.call(this);
|
||||
|
||||
if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
this._dispatchEvent("changeSelection", {});
|
||||
};
|
||||
|
||||
this.selectTo = function(row, column) {
|
||||
|
|
@ -253,15 +242,9 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.selectWord = function() {
|
||||
var cursor = this.selectionLead;
|
||||
var column = cursor.column;
|
||||
var range = this.doc.getWordRange(cursor.row, column);
|
||||
var cursor = this.getCursor();
|
||||
var range = this.session.getWordRange(cursor.row, cursor.column);
|
||||
this.setSelectionRange(range);
|
||||
|
||||
/*this.setSelectionAnchor(cursor.row, start);
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(cursor.row, end);
|
||||
});*/
|
||||
};
|
||||
|
||||
this.selectLine = function() {
|
||||
|
|
@ -280,18 +263,16 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.moveCursorLeft = function() {
|
||||
if (this.selectionLead.column == 0) {
|
||||
var cursor = this.selectionLead.getPosition();
|
||||
if (cursor.column == 0) {
|
||||
// cursor is a line (start
|
||||
if (this.selectionLead.row > 0) {
|
||||
this.moveCursorTo(this.selectionLead.row - 1, this.doc
|
||||
.getLine(this.selectionLead.row - 1).length);
|
||||
if (cursor.row > 0) {
|
||||
this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var doc = this.doc;
|
||||
var tabSize = doc.getTabSize();
|
||||
var cursor = this.selectionLead;
|
||||
if (doc.isTabStop(cursor) && doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
|
||||
var tabSize = this.session.getTabSize();
|
||||
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
|
||||
this.moveCursorBy(0, -tabSize);
|
||||
else
|
||||
this.moveCursorBy(0, -1);
|
||||
|
|
@ -305,10 +286,9 @@ var Selection = function(doc) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
var doc = this.doc;
|
||||
var tabSize = doc.getTabSize();
|
||||
var tabSize = this.session.getTabSize();
|
||||
var cursor = this.selectionLead;
|
||||
if (doc.isTabStop(cursor) && doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
|
||||
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
|
||||
this.moveCursorBy(0, tabSize);
|
||||
else
|
||||
this.moveCursorBy(0, 1);
|
||||
|
|
@ -318,12 +298,12 @@ var Selection = function(doc) {
|
|||
this.moveCursorLineStart = function() {
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
var screenRow = this.doc.documentToScreenRow(row, column);
|
||||
var firstRowColumn = this.doc.getScreenFirstRowColumn(screenRow);
|
||||
var screenRow = this.session.documentToScreenRow(row, column);
|
||||
var firstRowColumn = this.session.getScreenFirstRowColumn(screenRow);
|
||||
var beforeCursor = this.doc.getLine(row).slice(firstRowColumn, column);
|
||||
var leadingSpace = beforeCursor.match(/^\s*/);
|
||||
if (leadingSpace[0].length == 0) {
|
||||
var lastRowColumn = this.doc.getDocumentLastRowColumn(row, column);
|
||||
var lastRowColumn = this.session.getDocumentLastRowColumn(row, column);
|
||||
leadingSpace = this.doc.getLine(row).
|
||||
substring(firstRowColumn, lastRowColumn).
|
||||
match(/^\s*/);
|
||||
|
|
@ -336,9 +316,8 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.moveCursorLineEnd = function() {
|
||||
var selLead = this.selectionLead;
|
||||
this.moveCursorTo(selLead.row,
|
||||
this.doc.getDocumentLastRowColumn(selLead.row, selLead.column));
|
||||
var lead = this.selectionLead;
|
||||
this.moveCursorTo(lead.row, this.session.getDocumentLastRowColumn(lead.row, lead.column));
|
||||
};
|
||||
|
||||
this.moveCursorFileEnd = function() {
|
||||
|
|
@ -358,20 +337,20 @@ var Selection = function(doc) {
|
|||
var rightOfCursor = line.substring(column);
|
||||
|
||||
var match;
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
|
||||
if (column == line.length) {
|
||||
this.moveCursorRight();
|
||||
return;
|
||||
}
|
||||
else if (match = this.doc.nonTokenRe.exec(rightOfCursor)) {
|
||||
column += this.doc.nonTokenRe.lastIndex;
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
else if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.nonTokenRe.lastIndex;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
}
|
||||
else if (match = this.doc.tokenRe.exec(rightOfCursor)) {
|
||||
column += this.doc.tokenRe.lastIndex;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
else if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
||||
column += this.session.tokenRe.lastIndex;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
}
|
||||
|
||||
this.moveCursorTo(row, column);
|
||||
|
|
@ -384,83 +363,58 @@ var Selection = function(doc) {
|
|||
var leftOfCursor = lang.stringReverse(line.substring(0, column));
|
||||
|
||||
var match;
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
|
||||
if (column == 0) {
|
||||
this.moveCursorLeft();
|
||||
return;
|
||||
}
|
||||
else if (match = this.doc.nonTokenRe.exec(leftOfCursor)) {
|
||||
column -= this.doc.nonTokenRe.lastIndex;
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
else if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
|
||||
column -= this.session.nonTokenRe.lastIndex;
|
||||
this.session.nonTokenRe.lastIndex = 0;
|
||||
}
|
||||
else if (match = this.doc.tokenRe.exec(leftOfCursor)) {
|
||||
column -= this.doc.tokenRe.lastIndex;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
else if (match = this.session.tokenRe.exec(leftOfCursor)) {
|
||||
column -= this.session.tokenRe.lastIndex;
|
||||
this.session.tokenRe.lastIndex = 0;
|
||||
}
|
||||
|
||||
this.moveCursorTo(row, column);
|
||||
};
|
||||
|
||||
this.moveCursorBy = function(rows, chars) {
|
||||
if (this.doc.getUseWrapMode()) {
|
||||
var screenPos = this.doc.documentToScreenPosition(
|
||||
this.selectionLead.row, this.selectionLead.column);
|
||||
var screenCol =
|
||||
(chars == 0 && this.$desiredColumn) || screenPos.column;
|
||||
|
||||
var docPos = this.doc.screenToDocumentPosition(
|
||||
screenPos.row + rows, screenCol);
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var screenPos = this.session.documentToScreenPosition(
|
||||
this.selectionLead.row,
|
||||
this.selectionLead.column
|
||||
);
|
||||
var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
||||
} else {
|
||||
var docColumn =
|
||||
(chars == 0 && this.$desiredColumn) || this.selectionLead.column;
|
||||
this.moveCursorTo(
|
||||
this.selectionLead.row + rows, docColumn + chars, chars == 0);
|
||||
var docColumn = (chars == 0 && this.$desiredColumn) || this.selectionLead.column;
|
||||
this.moveCursorTo(this.selectionLead.row + rows, docColumn + chars, chars == 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.moveCursorToPosition = function(position) {
|
||||
this.moveCursorTo(position.row, position.column);
|
||||
};
|
||||
|
||||
this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
|
||||
var cursor = this.$clipPositionToDocument(row, column);
|
||||
|
||||
// only dispatch change if the cursor actually changed
|
||||
if (cursor.row !== this.selectionLead.row || cursor.column !== this.selectionLead.column) {
|
||||
this.selectionLead = cursor;
|
||||
!preventUpdateDesiredColumn && this.$updateDesiredColumn(column);
|
||||
this._dispatchEvent("changeCursor", { data: this.getCursor() });
|
||||
}
|
||||
this.selectionLead.setPosition(row, column);
|
||||
if (!preventUpdateDesiredColumn)
|
||||
this.$updateDesiredColumn(this.selectionLead.column);
|
||||
};
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
if (row >= this.doc.getLength()) {
|
||||
pos.row = Math.max(0, this.doc.getLength() - 1);
|
||||
pos.column = this.doc.getLine(pos.row).length;
|
||||
this.moveCursorToScreen = function(row, column, preventUpdateDesiredColumn) {
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var pos = this.session.screenToDocumentPosition(row, column);
|
||||
row = pos.row;
|
||||
column = pos.column;
|
||||
}
|
||||
else if (row < 0) {
|
||||
pos.row = 0;
|
||||
pos.column = 0;
|
||||
}
|
||||
else {
|
||||
pos.row = row;
|
||||
pos.column = Math.min(this.doc.getLine(pos.row).length,
|
||||
Math.max(0, column));
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
this.$clone = function(pos) {
|
||||
return {
|
||||
row: pos.row,
|
||||
column: pos.column
|
||||
};
|
||||
this.moveCursorTo(row, column, preventUpdateDesiredColumn);
|
||||
};
|
||||
|
||||
}).call(Selection.prototype);
|
||||
|
|
|
|||
|
|
@ -37,9 +37,11 @@
|
|||
|
||||
require("../../../support/paths");
|
||||
|
||||
require("./mockdom");
|
||||
var async = require("asyncjs");
|
||||
|
||||
async.concat(
|
||||
require("./anchor_test"),
|
||||
require("./change_document_test"),
|
||||
require("./document_test"),
|
||||
require("./edit_session_test"),
|
||||
|
|
|
|||
75
lib/ace/test/all_browser.js
Normal file
75
lib/ace/test/all_browser.js
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
var async = require("asyncjs");
|
||||
var dom = require("pilot/dom");
|
||||
|
||||
var passed = 0
|
||||
var failed = 0
|
||||
var log = document.getElementById("log")
|
||||
|
||||
async.concat(
|
||||
require("./anchor_test"),
|
||||
require("./change_document_test"),
|
||||
require("./document_test"),
|
||||
require("./edit_session_test"),
|
||||
require("./event_emitter_test"),
|
||||
require("./navigation_test"),
|
||||
require("./range_test"),
|
||||
require("./search_test"),
|
||||
require("./selection_test"),
|
||||
require("./text_edit_test"),
|
||||
require("./virtual_renderer_test"),
|
||||
require("./mode/css_test"),
|
||||
require("./mode/css_tokenizer_test"),
|
||||
require("./mode/html_test"),
|
||||
require("./mode/html_tokenizer_test"),
|
||||
require("./mode/javascript_test"),
|
||||
require("./mode/javascript_tokenizer_test"),
|
||||
require("./mode/text_test"),
|
||||
require("./mode/xml_test"),
|
||||
require("./mode/xml_tokenizer_test")
|
||||
)
|
||||
.run()
|
||||
.each(function(test, next) {
|
||||
var node = document.createElement("div");
|
||||
node.className = test.passed ? "passed" : "failed";
|
||||
|
||||
var name = test.name
|
||||
if (test.suiteName)
|
||||
name = test.suiteName + ": " + test.name
|
||||
|
||||
var msg = "[" + test.count + "/" + test.index + "] " + name + " " + (test.passed ? "OK" : "FAIL")
|
||||
if (!test.passed) {
|
||||
if (test.err.stack)
|
||||
var err = test.err.stack
|
||||
else
|
||||
var err = test.err
|
||||
|
||||
msg += "<pre class='error'>" + err + "</pre>";
|
||||
}
|
||||
|
||||
node.innerHTML = msg;
|
||||
log.appendChild(node);
|
||||
|
||||
next()
|
||||
})
|
||||
.each(function(test) {
|
||||
if (test.passed)
|
||||
passed += 1
|
||||
else
|
||||
failed += 1
|
||||
})
|
||||
.end(function() {
|
||||
log.innerHTML += [
|
||||
"<div class='summary'>",
|
||||
"<br>",
|
||||
"Summary: <br>",
|
||||
"<br>",
|
||||
"Total number of tests: " + (passed + failed) + "<br>",
|
||||
(passed ? "Passed tests: " + passed + "<br>" : ""),
|
||||
(failed ? "Failed tests: " + failed + "<br>" : "")
|
||||
].join("")
|
||||
})
|
||||
|
||||
});
|
||||
183
lib/ace/test/anchor_test.js
Normal file
183
lib/ace/test/anchor_test.js
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Document = require("ace/document").Document;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
var Range = require("ace/range").Range;
|
||||
var assert = require("./assertions");
|
||||
var async = require("asyncjs");
|
||||
|
||||
var Test = {
|
||||
|
||||
"test create anchor" : function() {
|
||||
var doc = new Document("juhu");
|
||||
var anchor = new Anchor(doc, 0, 0);
|
||||
|
||||
assert.position(anchor.getPosition(), 0, 0);
|
||||
assert.equal(anchor.getDocument(), doc);
|
||||
},
|
||||
|
||||
"test insert text in same row before cursor should move anchor column": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.insert({row: 1, column: 1}, "123");
|
||||
assert.position(anchor.getPosition(), 1, 7);
|
||||
},
|
||||
|
||||
"test insert lines before cursor should move anchor row": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.insertLines(1, ["123", "456"]);
|
||||
assert.position(anchor.getPosition(), 3, 4);
|
||||
},
|
||||
|
||||
"test insert new line before cursor should move anchor column": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.insertNewLine({row: 0, column: 0});
|
||||
assert.position(anchor.getPosition(), 2, 4);
|
||||
},
|
||||
|
||||
"test insert new line in anchor line before anchor should move anchor column and row": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.insertNewLine({row: 1, column: 2});
|
||||
assert.position(anchor.getPosition(), 2, 2);
|
||||
},
|
||||
|
||||
"test delete text in anchor line before anchor should move anchor column": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.remove(new Range(1, 1, 1, 3));
|
||||
assert.position(anchor.getPosition(), 1, 2);
|
||||
},
|
||||
|
||||
"test remove range which contains the anchor should move the anchor to the start of the range": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 0, 3);
|
||||
|
||||
doc.remove(new Range(0, 1, 1, 3));
|
||||
assert.position(anchor.getPosition(), 0, 1);
|
||||
},
|
||||
|
||||
"test delete character before the anchor should have no effect": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.remove(new Range(1, 4, 1, 5));
|
||||
assert.position(anchor.getPosition(), 1, 4);
|
||||
},
|
||||
|
||||
"test delete lines in anchor line before anchor should move anchor row": function() {
|
||||
var doc = new Document("juhu\n1\n2\nkinners");
|
||||
var anchor = new Anchor(doc, 3, 4);
|
||||
|
||||
doc.removeLines(1, 2);
|
||||
assert.position(anchor.getPosition(), 1, 4);
|
||||
},
|
||||
|
||||
"test remove new line before the cursor": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.removeNewLine(0);
|
||||
assert.position(anchor.getPosition(), 0, 8);
|
||||
},
|
||||
|
||||
"test delete range which contains the anchor should move anchor to the end of the range": function() {
|
||||
var doc = new Document("juhu\nkinners");
|
||||
var anchor = new Anchor(doc, 1, 4);
|
||||
|
||||
doc.remove(new Range(0, 2, 1, 2));
|
||||
assert.position(anchor.getPosition(), 0, 4);
|
||||
},
|
||||
|
||||
"test delete line which contains the anchor should move anchor to the end of the range": function() {
|
||||
var doc = new Document("juhu\nkinners\n123");
|
||||
var anchor = new Anchor(doc, 1, 5);
|
||||
|
||||
doc.removeLines(1, 1);
|
||||
assert.position(anchor.getPosition(), 1, 0);
|
||||
},
|
||||
|
||||
"test remove after the anchor should have no effect": function() {
|
||||
var doc = new Document("juhu\nkinners\n123");
|
||||
var anchor = new Anchor(doc, 1, 2);
|
||||
|
||||
doc.remove(new Range(1, 4, 2, 2));
|
||||
assert.position(anchor.getPosition(), 1, 2);
|
||||
},
|
||||
|
||||
"test anchor changes triggered by document changes should emit change event": function(next) {
|
||||
var doc = new Document("juhu\nkinners\n123");
|
||||
var anchor = new Anchor(doc, 1, 5);
|
||||
|
||||
anchor.on("change", function(e) {
|
||||
assert.position(anchor.getPosition(), 0, 0);
|
||||
next();
|
||||
});
|
||||
|
||||
doc.remove(new Range(0, 0, 2, 1));
|
||||
},
|
||||
|
||||
"test only fire change event if position changes": function() {
|
||||
var doc = new Document("juhu\nkinners\n123");
|
||||
var anchor = new Anchor(doc, 1, 5);
|
||||
|
||||
anchor.on("change", function(e) {
|
||||
assert.fail();
|
||||
});
|
||||
|
||||
doc.remove(new Range(2, 0, 2, 1));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = require("asyncjs/test").testcase(Test);
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("../../../support/paths");
|
||||
exports.exec()
|
||||
}
|
||||
306
lib/ace/test/asyncjs/assert.js
Normal file
306
lib/ace/test/asyncjs/assert.js
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
||||
//
|
||||
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
||||
//
|
||||
// Originally from narwhal.js (http://narwhaljs.org)
|
||||
// Copyright (c) 2009 Thomas Robinson <280north.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the 'Software'), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// UTILITY
|
||||
var oop = require('pilot/oop');
|
||||
var pSlice = Array.prototype.slice;
|
||||
|
||||
// 1. The assert module provides functions that throw
|
||||
// AssertionError's when particular conditions are not met. The
|
||||
// assert module must conform to the following interface.
|
||||
|
||||
var assert = exports;
|
||||
|
||||
// 2. The AssertionError is defined in assert.
|
||||
// new assert.AssertionError({ message: message,
|
||||
// actual: actual,
|
||||
// expected: expected })
|
||||
|
||||
assert.AssertionError = function AssertionError(options) {
|
||||
this.name = 'AssertionError';
|
||||
this.message = options.message;
|
||||
this.actual = options.actual;
|
||||
this.expected = options.expected;
|
||||
this.operator = options.operator;
|
||||
var stackStartFunction = options.stackStartFunction || fail;
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, stackStartFunction);
|
||||
}
|
||||
};
|
||||
oop.inherits(assert.AssertionError, Error);
|
||||
|
||||
assert.AssertionError.prototype.toString = function() {
|
||||
if (this.message) {
|
||||
return [this.name + ':', this.message].join(' ');
|
||||
} else {
|
||||
return [this.name + ':',
|
||||
JSON.stringify(this.expected),
|
||||
this.operator,
|
||||
JSON.stringify(this.actual)].join(' ');
|
||||
}
|
||||
};
|
||||
|
||||
// assert.AssertionError instanceof Error
|
||||
|
||||
assert.AssertionError.__proto__ = Error.prototype;
|
||||
|
||||
// At present only the three keys mentioned above are used and
|
||||
// understood by the spec. Implementations or sub modules can pass
|
||||
// other keys to the AssertionError's constructor - they will be
|
||||
// ignored.
|
||||
|
||||
// 3. All of the following functions must throw an AssertionError
|
||||
// when a corresponding condition is not met, with a message that
|
||||
// may be undefined if not provided. All assertion methods provide
|
||||
// both the actual and expected values to the assertion error for
|
||||
// display purposes.
|
||||
|
||||
function fail(actual, expected, message, operator, stackStartFunction) {
|
||||
throw new assert.AssertionError({
|
||||
message: message,
|
||||
actual: actual,
|
||||
expected: expected,
|
||||
operator: operator,
|
||||
stackStartFunction: stackStartFunction
|
||||
});
|
||||
}
|
||||
|
||||
// EXTENSION! allows for well behaved errors defined elsewhere.
|
||||
assert.fail = fail;
|
||||
|
||||
// 4. Pure assertion tests whether a value is truthy, as determined
|
||||
// by !!guard.
|
||||
// assert.ok(guard, message_opt);
|
||||
// This statement is equivalent to assert.equal(true, guard,
|
||||
// message_opt);. To test strictly for the value true, use
|
||||
// assert.strictEqual(true, guard, message_opt);.
|
||||
|
||||
assert.ok = function ok(value, message) {
|
||||
if (!!!value) fail(value, true, message, '==', assert.ok);
|
||||
};
|
||||
|
||||
// 5. The equality assertion tests shallow, coercive equality with
|
||||
// ==.
|
||||
// assert.equal(actual, expected, message_opt);
|
||||
|
||||
assert.equal = function equal(actual, expected, message) {
|
||||
if (actual != expected) fail(actual, expected, message, '==', assert.equal);
|
||||
};
|
||||
|
||||
// 6. The non-equality assertion tests for whether two objects are not equal
|
||||
// with != assert.notEqual(actual, expected, message_opt);
|
||||
|
||||
assert.notEqual = function notEqual(actual, expected, message) {
|
||||
if (actual == expected) {
|
||||
fail(actual, expected, message, '!=', assert.notEqual);
|
||||
}
|
||||
};
|
||||
|
||||
// 7. The equivalence assertion tests a deep equality relation.
|
||||
// assert.deepEqual(actual, expected, message_opt);
|
||||
|
||||
assert.deepEqual = function deepEqual(actual, expected, message) {
|
||||
if (!_deepEqual(actual, expected)) {
|
||||
fail(actual, expected, message, 'deepEqual', assert.deepEqual);
|
||||
}
|
||||
};
|
||||
|
||||
function _deepEqual(actual, expected) {
|
||||
// 7.1. All identical values are equivalent, as determined by ===.
|
||||
if (actual === expected) {
|
||||
return true;
|
||||
|
||||
} else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
|
||||
if (actual.length != expected.length) return false;
|
||||
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
if (actual[i] !== expected[i]) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// 7.2. If the expected value is a Date object, the actual value is
|
||||
// equivalent if it is also a Date object that refers to the same time.
|
||||
} else if (actual instanceof Date && expected instanceof Date) {
|
||||
return actual.getTime() === expected.getTime();
|
||||
|
||||
// 7.3. Other pairs that do not both pass typeof value == 'object',
|
||||
// equivalence is determined by ==.
|
||||
} else if (typeof actual != 'object' && typeof expected != 'object') {
|
||||
return actual == expected;
|
||||
|
||||
// 7.4. For all other Object pairs, including Array objects, equivalence is
|
||||
// determined by having the same number of owned properties (as verified
|
||||
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
||||
// (although not necessarily the same order), equivalent values for every
|
||||
// corresponding key, and an identical 'prototype' property. Note: this
|
||||
// accounts for both named and indexed properties on Arrays.
|
||||
} else {
|
||||
return objEquiv(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
function isUndefinedOrNull(value) {
|
||||
return value === null || value === undefined;
|
||||
}
|
||||
|
||||
function isArguments(object) {
|
||||
return Object.prototype.toString.call(object) == '[object Arguments]';
|
||||
}
|
||||
|
||||
function objEquiv(a, b) {
|
||||
if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
|
||||
return false;
|
||||
// an identical 'prototype' property.
|
||||
if (a.prototype !== b.prototype) return false;
|
||||
//~~~I've managed to break Object.keys through screwy arguments passing.
|
||||
// Converting to array solves the problem.
|
||||
if (isArguments(a)) {
|
||||
if (!isArguments(b)) {
|
||||
return false;
|
||||
}
|
||||
a = pSlice.call(a);
|
||||
b = pSlice.call(b);
|
||||
return _deepEqual(a, b);
|
||||
}
|
||||
try {
|
||||
var ka = Object.keys(a),
|
||||
kb = Object.keys(b),
|
||||
key, i;
|
||||
} catch (e) {//happens when one is a string literal and the other isn't
|
||||
return false;
|
||||
}
|
||||
// having the same number of owned properties (keys incorporates
|
||||
// hasOwnProperty)
|
||||
if (ka.length != kb.length)
|
||||
return false;
|
||||
//the same set of keys (although not necessarily the same order),
|
||||
ka.sort();
|
||||
kb.sort();
|
||||
//~~~cheap key test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
if (ka[i] != kb[i])
|
||||
return false;
|
||||
}
|
||||
//equivalent values for every corresponding key, and
|
||||
//~~~possibly expensive deep test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
key = ka[i];
|
||||
if (!_deepEqual(a[key], b[key])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 8. The non-equivalence assertion tests for any deep inequality.
|
||||
// assert.notDeepEqual(actual, expected, message_opt);
|
||||
|
||||
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
|
||||
if (_deepEqual(actual, expected)) {
|
||||
fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
|
||||
}
|
||||
};
|
||||
|
||||
// 9. The strict equality assertion tests strict equality, as determined by ===.
|
||||
// assert.strictEqual(actual, expected, message_opt);
|
||||
|
||||
assert.strictEqual = function strictEqual(actual, expected, message) {
|
||||
if (actual !== expected) {
|
||||
fail(actual, expected, message, '===', assert.strictEqual);
|
||||
}
|
||||
};
|
||||
|
||||
// 10. The strict non-equality assertion tests for strict inequality, as
|
||||
// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
|
||||
|
||||
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
|
||||
if (actual === expected) {
|
||||
fail(actual, expected, message, '!==', assert.notStrictEqual);
|
||||
}
|
||||
};
|
||||
|
||||
function expectedException(actual, expected) {
|
||||
if (!actual || !expected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(actual);
|
||||
} else if (actual instanceof expected) {
|
||||
return true;
|
||||
} else if (expected.call({}, actual) === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _throws(shouldThrow, block, expected, message) {
|
||||
var actual;
|
||||
|
||||
if (typeof expected === 'string') {
|
||||
message = expected;
|
||||
expected = null;
|
||||
}
|
||||
|
||||
try {
|
||||
block();
|
||||
} catch (e) {
|
||||
actual = e;
|
||||
}
|
||||
|
||||
message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
|
||||
(message ? ' ' + message : '.');
|
||||
|
||||
if (shouldThrow && !actual) {
|
||||
fail('Missing expected exception' + message);
|
||||
}
|
||||
|
||||
if (!shouldThrow && expectedException(actual, expected)) {
|
||||
fail('Got unwanted exception' + message);
|
||||
}
|
||||
|
||||
if ((shouldThrow && actual && expected &&
|
||||
!expectedException(actual, expected)) || (!shouldThrow && actual)) {
|
||||
throw actual;
|
||||
}
|
||||
}
|
||||
|
||||
// 11. Expected to throw an error:
|
||||
// assert.throws(block, Error_opt, message_opt);
|
||||
|
||||
assert.throws = function(block, /*optional*/error, /*optional*/message) {
|
||||
_throws.apply(this, [true].concat(pSlice.call(arguments)));
|
||||
};
|
||||
|
||||
// EXTENSION! This is annoying to write outside this module.
|
||||
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
|
||||
_throws.apply(this, [false].concat(pSlice.call(arguments)));
|
||||
};
|
||||
|
||||
assert.ifError = function(err) { if (err) {throw err;}};
|
||||
|
||||
});
|
||||
489
lib/ace/test/asyncjs/async.js
Normal file
489
lib/ace/test/asyncjs/async.js
Normal file
|
|
@ -0,0 +1,489 @@
|
|||
/*!
|
||||
* async.js
|
||||
* Copyright(c) 2010 Fabian Jakobs <fabian.jakobs@web.de>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var STOP = exports.STOP = {}
|
||||
|
||||
exports.Generator = function(source) {
|
||||
if (typeof source == "function")
|
||||
this.source = {
|
||||
next: source
|
||||
}
|
||||
else
|
||||
this.source = source
|
||||
}
|
||||
|
||||
;(function() {
|
||||
this.next = function(callback) {
|
||||
this.source.next(callback)
|
||||
}
|
||||
|
||||
this.map = function(mapper) {
|
||||
if (!mapper)
|
||||
return this
|
||||
|
||||
mapper = makeAsync(1, mapper)
|
||||
|
||||
var source = this.source
|
||||
this.next = function(callback) {
|
||||
source.next(function(err, value) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else {
|
||||
mapper(value, function(err, value) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else
|
||||
callback(null, value)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.filter = function(filter) {
|
||||
if (!filter)
|
||||
return this
|
||||
|
||||
filter = makeAsync(1, filter)
|
||||
|
||||
var source = this.source
|
||||
this.next = function(callback) {
|
||||
source.next(function handler(err, value) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else {
|
||||
filter(value, function(err, takeIt) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else if (takeIt)
|
||||
callback(null, value)
|
||||
else
|
||||
source.next(handler)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.slice = function(begin, end) {
|
||||
var count = -1
|
||||
if (!end || end < 0)
|
||||
var end = Infinity
|
||||
|
||||
var source = this.source
|
||||
this.next = function(callback) {
|
||||
source.next(function handler(err, value) {
|
||||
count++
|
||||
if (err)
|
||||
callback(err)
|
||||
else if (count >= begin && count < end)
|
||||
callback(null, value)
|
||||
else if (count >= end)
|
||||
callback(STOP)
|
||||
else
|
||||
source.next(handler)
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.reduce = function(reduce, initialValue) {
|
||||
reduce = makeAsync(3, reduce)
|
||||
|
||||
var index = 0
|
||||
var done = false
|
||||
var previousValue = initialValue
|
||||
|
||||
var source = this.source
|
||||
this.next = function(callback) {
|
||||
if (done)
|
||||
return callback(STOP)
|
||||
|
||||
if (initialValue === undefined) {
|
||||
source.next(function(err, currentValue) {
|
||||
if (err)
|
||||
return callback(err, previousValue)
|
||||
|
||||
previousValue = currentValue
|
||||
reduceAll()
|
||||
})
|
||||
}
|
||||
else
|
||||
reduceAll()
|
||||
|
||||
function reduceAll() {
|
||||
source.next(function handler(err, currentValue) {
|
||||
if (err) {
|
||||
done = true
|
||||
if (err == STOP)
|
||||
return callback(null, previousValue)
|
||||
else
|
||||
return(err)
|
||||
}
|
||||
reduce(previousValue, currentValue, index++, function(err, value) {
|
||||
previousValue = value
|
||||
source.next(handler)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.forEach =
|
||||
this.each = function(fn) {
|
||||
fn = makeAsync(1, fn)
|
||||
|
||||
var source = this.source
|
||||
this.next = function(callback) {
|
||||
source.next(function handler(err, value) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else {
|
||||
fn(value, function(err) {
|
||||
callback(err, value)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.some = function(condition) {
|
||||
condition = makeAsync(1, condition)
|
||||
|
||||
var source = this.source
|
||||
var done = false
|
||||
this.next = function(callback) {
|
||||
if (done)
|
||||
return callback(STOP)
|
||||
|
||||
source.next(function handler(err, value) {
|
||||
if (err)
|
||||
return callback(err)
|
||||
|
||||
condition(value, function(err, result) {
|
||||
if (err) {
|
||||
done = true
|
||||
if (err == STOP)
|
||||
callback(null, false)
|
||||
else
|
||||
callback(err)
|
||||
}
|
||||
else if (result) {
|
||||
done = true
|
||||
callback(null, true)
|
||||
}
|
||||
else
|
||||
source.next(handler)
|
||||
})
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.every = function(condition) {
|
||||
condition = makeAsync(1, condition)
|
||||
|
||||
var source = this.source
|
||||
var done = false
|
||||
this.next = function(callback) {
|
||||
if (done)
|
||||
return callback(STOP)
|
||||
|
||||
source.next(function handler(err, value) {
|
||||
if (err)
|
||||
return callback(err)
|
||||
|
||||
condition(value, function(err, result) {
|
||||
if (err) {
|
||||
done = true
|
||||
if (err == STOP)
|
||||
callback(null, true)
|
||||
else
|
||||
callback(err)
|
||||
}
|
||||
else if (!result) {
|
||||
done = true
|
||||
callback(null, false)
|
||||
}
|
||||
else
|
||||
source.next(handler)
|
||||
})
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.call = function(context) {
|
||||
var source = this.source
|
||||
return this.map(function(fn, next) {
|
||||
fn = makeAsync(0, fn, context)
|
||||
fn.call(context, function(err, value) {
|
||||
next(err, value)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.concat = function(generator) {
|
||||
var generators = [this]
|
||||
generators.push.apply(generators, arguments)
|
||||
var index = 0
|
||||
var source = generators[index++]
|
||||
|
||||
return new this.constructor(function(callback) {
|
||||
source.next(function handler(err, value) {
|
||||
if (err) {
|
||||
if (err == STOP) {
|
||||
source = generators[index++]
|
||||
if (!source)
|
||||
return callback(STOP)
|
||||
else
|
||||
return source.next(handler)
|
||||
}
|
||||
else
|
||||
return callback(err)
|
||||
}
|
||||
else
|
||||
return callback(null, value)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.zip = function(generator) {
|
||||
var generators = [this]
|
||||
generators.push.apply(generators, arguments)
|
||||
|
||||
return new this.constructor(function(callback) {
|
||||
exports.list(generators)
|
||||
.map(function(gen, next) {
|
||||
gen.next(next)
|
||||
})
|
||||
.toArray(callback)
|
||||
})
|
||||
}
|
||||
|
||||
this.sort = function(compare) {
|
||||
var self = this
|
||||
var arrGen
|
||||
this.next = function(callback) {
|
||||
if (arrGen)
|
||||
return arrGen.next(callback)
|
||||
|
||||
self.toArray(function(err, arr) {
|
||||
if (err)
|
||||
callback(err)
|
||||
else {
|
||||
arrGen = exports.list(arr.sort(compare))
|
||||
arrGen.next(callback)
|
||||
}
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
}
|
||||
|
||||
this.join = function(separator) {
|
||||
return this.$arrayOp(Array.prototype.join, separator !== undefined ? [separator] : null)
|
||||
}
|
||||
|
||||
this.reverse = function() {
|
||||
return this.$arrayOp(Array.prototype.reverse)
|
||||
}
|
||||
|
||||
this.$arrayOp = function(arrayMethod, args) {
|
||||
var self = this
|
||||
var i = 0
|
||||
this.next = function(callback) {
|
||||
if (i++ > 0)
|
||||
return callback(STOP)
|
||||
|
||||
self.toArray(function(err, arr) {
|
||||
if (err)
|
||||
callback(err, "")
|
||||
else {
|
||||
if (args)
|
||||
callback(null, arrayMethod.apply(arr, args))
|
||||
else
|
||||
callback(null, arrayMethod.call(arr))
|
||||
}
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
|
||||
}
|
||||
|
||||
this.end = function(breakOnError, callback) {
|
||||
if (!callback) {
|
||||
callback = arguments[0]
|
||||
breakOnError = true
|
||||
}
|
||||
|
||||
var source = this.source
|
||||
var last
|
||||
var lastError
|
||||
source.next(function handler(err, value) {
|
||||
if (err) {
|
||||
if (err == STOP)
|
||||
callback && callback(lastError, last)
|
||||
else if (!breakOnError) {
|
||||
lastError = err
|
||||
source.next(handler)
|
||||
}
|
||||
else
|
||||
callback && callback(err, value)
|
||||
}
|
||||
else {
|
||||
last = value
|
||||
source.next(handler)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.toArray = function(breakOnError, callback) {
|
||||
if (!callback) {
|
||||
callback = arguments[0]
|
||||
breakOnError = true
|
||||
}
|
||||
|
||||
var values = []
|
||||
var errors = []
|
||||
var source = this.source
|
||||
|
||||
source.next(function handler(err, value) {
|
||||
if (err) {
|
||||
if (err == STOP) {
|
||||
if (breakOnError)
|
||||
return callback(null, values)
|
||||
else {
|
||||
errors.length = values.length
|
||||
return callback(errors, values)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (breakOnError)
|
||||
return callback(err)
|
||||
else
|
||||
errors[values.length] = err
|
||||
}
|
||||
}
|
||||
|
||||
values.push(value)
|
||||
source.next(handler)
|
||||
})
|
||||
}
|
||||
|
||||
}).call(exports.Generator.prototype)
|
||||
|
||||
var makeAsync = exports.makeAsync = function(args, fn, context) {
|
||||
if (fn.length > args)
|
||||
return fn
|
||||
else {
|
||||
return function() {
|
||||
var value
|
||||
var next = arguments[args]
|
||||
try {
|
||||
value = fn.apply(context || this, arguments)
|
||||
} catch(e) {
|
||||
return next(e)
|
||||
}
|
||||
next(null, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.list = function(arr, construct) {
|
||||
var construct = construct || exports.Generator
|
||||
var i = 0
|
||||
var len = arr.length
|
||||
|
||||
return new construct(function(callback) {
|
||||
if (i < len)
|
||||
callback(null, arr[i++])
|
||||
else
|
||||
callback(STOP)
|
||||
})
|
||||
}
|
||||
|
||||
exports.values = function(map, construct) {
|
||||
var values = []
|
||||
for (var key in map)
|
||||
values.push(map[key])
|
||||
|
||||
return exports.list(values, construct)
|
||||
}
|
||||
|
||||
exports.keys = function(map, construct) {
|
||||
var keys = []
|
||||
for (var key in map)
|
||||
keys.push(key)
|
||||
|
||||
return exports.list(keys, construct)
|
||||
}
|
||||
|
||||
/**
|
||||
* range([start,] stop[, step]) -> generator of integers
|
||||
*
|
||||
* Return a generator containing an arithmetic progression of integers.
|
||||
* range(i, j) returns [i, i+1, i+2, ..., j-1] start (!) defaults to 0.
|
||||
* When step is given, it specifies the increment (or decrement).
|
||||
*/
|
||||
exports.range = function(start, stop, step, construct) {
|
||||
var construct = construct || exports.Generator
|
||||
start = start || 0
|
||||
step = step || 1
|
||||
|
||||
if (stop === undefined || stop === null)
|
||||
stop = step > 0 ? Infinity : -Infinity
|
||||
|
||||
var value = start
|
||||
|
||||
return new construct(function(callback) {
|
||||
if (step > 0 && value >= stop || step < 0 && value <= stop)
|
||||
callback(STOP)
|
||||
else {
|
||||
var current = value
|
||||
value += step
|
||||
callback(null, current)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
exports.concat = function(first, varargs) {
|
||||
if (arguments.length > 1)
|
||||
return first.concat.apply(first, Array.prototype.slice.call(arguments, 1))
|
||||
else
|
||||
return first
|
||||
}
|
||||
|
||||
exports.zip = function(first, varargs) {
|
||||
if (arguments.length > 1)
|
||||
return first.zip.apply(first, Array.prototype.slice.call(arguments, 1))
|
||||
else
|
||||
return first.map(function(item, next) {
|
||||
next(null, [item])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
exports.plugin = function(members, constructors) {
|
||||
if (members) {
|
||||
for (var key in members) {
|
||||
exports.Generator.prototype[key] = members[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (constructors) {
|
||||
for (var key in constructors) {
|
||||
exports[key] = constructors[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
12
lib/ace/test/asyncjs/index.js
Normal file
12
lib/ace/test/asyncjs/index.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/*!
|
||||
* async.js
|
||||
* Copyright(c) 2010 Fabian Jakobs <fabian.jakobs@web.de>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
module.exports = require("./async")
|
||||
require("./utils")
|
||||
|
||||
})
|
||||
195
lib/ace/test/asyncjs/test.js
Normal file
195
lib/ace/test/asyncjs/test.js
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
/*!
|
||||
* async.js
|
||||
* Copyright(c) 2010 Fabian Jakobs <fabian.jakobs@web.de>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop")
|
||||
var async = require("asyncjs/async")
|
||||
require("asyncjs/utils")
|
||||
|
||||
exports.TestGenerator = function(source) {
|
||||
async.Generator.call(this, source)
|
||||
}
|
||||
|
||||
oop.inherits(exports.TestGenerator, async.Generator)
|
||||
|
||||
;(function() {
|
||||
|
||||
this.exec = function() {
|
||||
this.run().report().summary(function(err, passed) {
|
||||
console.log("DONE")
|
||||
})
|
||||
}
|
||||
|
||||
this.run = function() {
|
||||
return this.setupTest()
|
||||
.each(function(test, next) {
|
||||
if (test.setUpSuite)
|
||||
test.setUpSuite(next)
|
||||
else
|
||||
next()
|
||||
})
|
||||
.each(function(test, next) {
|
||||
test.test(function(err, passed) {
|
||||
test.err = err
|
||||
test.passed = passed
|
||||
next()
|
||||
})
|
||||
})
|
||||
.each(function(test, next) {
|
||||
if (test.tearDownSuite)
|
||||
test.tearDownSuite(next)
|
||||
else
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
this.report = function() {
|
||||
return this.each(function(test, next) {
|
||||
var color = test.passed ? "\x1b[32m" : "\x1b[31m"
|
||||
var name = test.name
|
||||
if (test.suiteName)
|
||||
name = test.suiteName + ": " + test.name
|
||||
console.log(color + "[" + test.count + "/" + test.index + "] " + name + " " + (test.passed ? "OK" : "FAIL") + "\x1b[0m")
|
||||
if (!test.passed)
|
||||
if (test.err.stack)
|
||||
console.log(test.err.stack)
|
||||
else
|
||||
console.log(test.err)
|
||||
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
this.summary = function(callback) {
|
||||
var passed = 0
|
||||
var failed = 0
|
||||
|
||||
this.each(function(test) {
|
||||
if (test.passed)
|
||||
passed += 1
|
||||
else
|
||||
failed += 1
|
||||
}).end(function() {
|
||||
console.log("")
|
||||
console.log("Summary:")
|
||||
console.log("")
|
||||
console.log( "Total number of tests: " + (passed + failed))
|
||||
passed && console.log("\x1b[32mPassed tests: " + passed + "\x1b[0m")
|
||||
failed && console.log("\x1b[31mFailed tests: " + failed + "\x1b[0m")
|
||||
console.log("")
|
||||
callback(null, failed == 0)
|
||||
})
|
||||
}
|
||||
|
||||
this.setupTest = function() {
|
||||
return this.each(function(test, next) {
|
||||
var empty = function(next) { next() }
|
||||
var context = test.context || this
|
||||
|
||||
if (test.setUp)
|
||||
var setUp = async.makeAsync(0, test.setUp, context)
|
||||
else
|
||||
setUp = empty
|
||||
|
||||
tearDownCalled = false
|
||||
if (test.tearDown)
|
||||
var tearDownInner = async.makeAsync(0, test.tearDown, context)
|
||||
else
|
||||
tearDownInner = empty
|
||||
|
||||
function tearDown(next) {
|
||||
tearDownCalled = true
|
||||
tearDownInner.call(test.context, next)
|
||||
}
|
||||
|
||||
var testFn = async.makeAsync(0, test.fn, context)
|
||||
|
||||
test.test = function(callback) {
|
||||
var called
|
||||
function errorListener(e) {
|
||||
if (called)
|
||||
return
|
||||
called = true
|
||||
//process.removeListener('uncaughtException', errorListener)
|
||||
if (!tearDownCalled) {
|
||||
async.list([tearDown])
|
||||
.call()
|
||||
.timeout(test.timeout)
|
||||
.end(function() {
|
||||
callback(e, false)
|
||||
}) }
|
||||
else
|
||||
callback(e, false)
|
||||
}
|
||||
//process.addListener('uncaughtException', errorListener)
|
||||
|
||||
async.list([setUp, testFn, tearDown])
|
||||
.delay(0)
|
||||
.call(context)
|
||||
.timeout(test.timeout)
|
||||
.toArray(false, function(errors, values) {
|
||||
if (called)
|
||||
return
|
||||
called = true
|
||||
var err = errors[1]
|
||||
//process.removeListener('uncaughtException', errorListener)
|
||||
callback(err, !err)
|
||||
})
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
}).call(exports.TestGenerator.prototype)
|
||||
|
||||
exports.testcase = function(testcase, suiteName, timeout) {
|
||||
var methods = []
|
||||
for (var method in testcase)
|
||||
methods.push(method)
|
||||
|
||||
var setUp = testcase.setUp || null
|
||||
var tearDown = testcase.tearDown || null
|
||||
|
||||
var single
|
||||
methods.forEach(function(name) {
|
||||
if (name.charAt(0) == '>')
|
||||
single = name
|
||||
})
|
||||
if (single)
|
||||
methods = [single]
|
||||
|
||||
var testNames = methods.filter(function(method) {
|
||||
return method.match(/^>?test/) && typeof(testcase[method]) == "function"
|
||||
})
|
||||
var count = testNames.length
|
||||
var i=1
|
||||
tests = testNames.map(function(name) {
|
||||
return {
|
||||
suiteName: suiteName || testcase.name || "",
|
||||
name: name,
|
||||
setUp: setUp,
|
||||
tearDown: tearDown,
|
||||
context: testcase,
|
||||
timeout: timeout === undefined ? 3000 : timeout,
|
||||
fn: testcase[name],
|
||||
count: count,
|
||||
index: i++
|
||||
}
|
||||
})
|
||||
|
||||
if (testcase.setUpSuite) {
|
||||
tests[0].setUpSuite = async.makeAsync(0, testcase.setUpSuite, testcase)
|
||||
}
|
||||
if (testcase.tearDownSuite) {
|
||||
tests[tests.length-1].tearDownSuite = async.makeAsync(0, testcase.tearDownSuite, testcase)
|
||||
}
|
||||
|
||||
return async.list(tests, exports.TestGenerator)
|
||||
}
|
||||
|
||||
})
|
||||
63
lib/ace/test/asyncjs/utils.js
Normal file
63
lib/ace/test/asyncjs/utils.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*!
|
||||
* async.js
|
||||
* Copyright(c) 2010 Fabian Jakobs <fabian.jakobs@web.de>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var async = require("asyncjs/async")
|
||||
|
||||
async.plugin({
|
||||
delay: function(delay) {
|
||||
return this.each(function(item, next) {
|
||||
setTimeout(next, delay)
|
||||
})
|
||||
},
|
||||
|
||||
timeout: function(timeout) {
|
||||
timeout = timeout || 0
|
||||
var source = this.source
|
||||
|
||||
this.next = function(callback) {
|
||||
var called
|
||||
var id = setTimeout(function() {
|
||||
called = true
|
||||
callback("Source did not respond after " + timeout + "ms!")
|
||||
}, timeout)
|
||||
|
||||
source.next(function(err, value) {
|
||||
if (called)
|
||||
return
|
||||
|
||||
called = true
|
||||
clearTimeout(id)
|
||||
|
||||
callback(err, value)
|
||||
})
|
||||
}
|
||||
return new this.constructor(this)
|
||||
},
|
||||
|
||||
get: function(key) {
|
||||
return this.map(function(value, next) {
|
||||
next(null, value[key])
|
||||
})
|
||||
},
|
||||
|
||||
inspect: function() {
|
||||
return this.each(function(item, next) {
|
||||
console.log(JSON.stringify(item))
|
||||
next()
|
||||
})
|
||||
},
|
||||
|
||||
print: function() {
|
||||
return this.each(function(item, next) {
|
||||
console.log(item)
|
||||
next()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
|
@ -37,8 +37,6 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
require("./mockdom");
|
||||
|
||||
var EditSession = require("../edit_session").EditSession,
|
||||
Editor = require("../editor").Editor,
|
||||
Text = require("../mode/text").Mode,
|
||||
|
|
@ -158,7 +156,7 @@ var Test = {
|
|||
module.exports = require("asyncjs/test").testcase(Test);
|
||||
});
|
||||
|
||||
if (module === require.main) {
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("../../../support/paths");
|
||||
exports.exec()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Document = require("../document").Document,
|
||||
Range = require("../range").Range,
|
||||
assert = require("./assertions"),
|
||||
|
|
@ -302,7 +304,9 @@ var Test = {
|
|||
|
||||
module.exports = require("asyncjs/test").testcase(Test);
|
||||
|
||||
if (module === require.main) {
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("../../../support/paths");
|
||||
exports.exec()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,14 +169,17 @@ var Test = {
|
|||
var wrapLimit = 12;
|
||||
var session = new EditSession(["foo bar foo bar"]);
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(12);
|
||||
session.setWrapLimitRange(12, 12);
|
||||
session.adjustWrapLimit(80);
|
||||
|
||||
assert.position(session.documentToScreenPosition(0, 11), 0, 11);
|
||||
assert.position(session.documentToScreenPosition(0, 12), 1, 0);
|
||||
|
||||
session = new EditSession(["ぁぁa"]);
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(2);
|
||||
session.setWrapLimitRange(2, 2);
|
||||
session.adjustWrapLimit(80);
|
||||
|
||||
assert.position(session.documentToScreenPosition(0, 1), 1, 0);
|
||||
assert.position(session.documentToScreenPosition(0, 2), 2, 0);
|
||||
assert.position(session.documentToScreenPosition(0, 4), 2, 1);
|
||||
|
|
@ -202,7 +205,8 @@ var Test = {
|
|||
var wrapLimit = 12;
|
||||
var session = new EditSession(["foo bar foo bar"]);
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(12);
|
||||
session.setWrapLimitRange(12, 12);
|
||||
session.adjustWrapLimit(80);
|
||||
|
||||
assert.position(session.screenToDocumentPosition(1, 0), 0, 12);
|
||||
assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
|
||||
|
|
@ -212,6 +216,8 @@ var Test = {
|
|||
|
||||
session = new EditSession(["ぁ a"]);
|
||||
session.setUseWrapMode(true);
|
||||
session.adjustWrapLimit(80);
|
||||
|
||||
assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
|
||||
assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
|
||||
assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
|
||||
|
|
@ -228,7 +234,7 @@ var Test = {
|
|||
wrapLimit = wrapLimit || 12;
|
||||
tabSize = tabSize || 4;
|
||||
splits = computeWrapSplits.call(EditSession.prototype, line, wrapLimit, tabSize);
|
||||
console.log("String:", line, "Result:", splits, "Expected:", assertEqual);
|
||||
// console.log("String:", line, "Result:", splits, "Expected:", assertEqual);
|
||||
assert.ok(splits.length == assertEqual.length);
|
||||
for (var i = 0; i < splits.length; i++) {
|
||||
assert.ok(splits[i] == assertEqual[i]);
|
||||
|
|
@ -263,72 +269,6 @@ var Test = {
|
|||
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
|
||||
},
|
||||
|
||||
"test: insert text in multiple rows": function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
|
||||
var inserted = session.multiRowInsert([0, 1, 2], 2, "juhu 1");
|
||||
assert.equal(inserted.rows, 0);
|
||||
assert.equal(inserted.columns, 6);
|
||||
|
||||
assert.equal(session.getValue(), ["12juhu 1", " juhu 1", "abjuhu 1cd"].join("\n"));
|
||||
},
|
||||
|
||||
"test: undo insert text in multiple rows": function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
|
||||
var undoManager = new UndoManager();
|
||||
session.setUndoManager(undoManager);
|
||||
|
||||
session.multiRowInsert([0, 1, 2], 2, "juhu 1");
|
||||
session.$informUndoManager.call();
|
||||
assert.equal(session.getValue(), ["12juhu 1", " juhu 1", "abjuhu 1cd"].join("\n"));
|
||||
|
||||
undoManager.undo();
|
||||
assert.equal(session.getValue(), ["12", "", "abcd"].join("\n"));
|
||||
|
||||
undoManager.redo();
|
||||
assert.equal(session.getValue(), ["12juhu 1", " juhu 1", "abjuhu 1cd"].join("\n"));
|
||||
},
|
||||
|
||||
"test: insert new line in multiple rows": function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
|
||||
var inserted = session.multiRowInsert([0, 1, 2], 2, "\n");
|
||||
assert.equal(inserted.rows, 1);
|
||||
assert.equal(session.getValue(), ["12\n", " \n", "ab\ncd"].join("\n"));
|
||||
},
|
||||
|
||||
"test: insert multi line text in multiple rows": function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
|
||||
var inserted = session.multiRowInsert([0, 1, 2], 2, "juhu\n12");
|
||||
assert.equal(inserted.rows, 1);
|
||||
assert.equal(session.getValue(), ["12juhu\n12", " juhu\n12", "abjuhu\n12cd"].join("\n"));
|
||||
},
|
||||
|
||||
"test: remove right in multiple rows" : function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
|
||||
session.multiRowRemove([0, 1, 2], new Range(0, 2, 0, 3));
|
||||
assert.equal(session.getValue(), ["12", "", "abd"].join("\n"));
|
||||
},
|
||||
|
||||
"test: undo remove right in multiple rows" : function() {
|
||||
var session = new EditSession(["12", "", "abcd"]);
|
||||
var undoManager = new UndoManager();
|
||||
session.setUndoManager(undoManager);
|
||||
|
||||
session.multiRowRemove([0, 1, 2], new Range(0, 1, 0, 3));
|
||||
session.$informUndoManager.call();
|
||||
assert.equal(session.getValue(), ["1", "", "ad"].join("\n"));
|
||||
|
||||
undoManager.undo();
|
||||
assert.equal(session.getValue(), ["12", "", "abcd"].join("\n"));
|
||||
|
||||
undoManager.redo();
|
||||
assert.equal(session.getValue(), ["1", "", "ad"].join("\n"));
|
||||
},
|
||||
|
||||
"test get longest line" : function() {
|
||||
var session = new EditSession(["12"]);
|
||||
session.setTabSize(4);
|
||||
|
|
@ -378,7 +318,8 @@ var Test = {
|
|||
var document = session.getDocument();
|
||||
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimit(3);
|
||||
session.setWrapLimitRange(3, 3);
|
||||
session.adjustWrapLimit(80);
|
||||
|
||||
// Test if wrapData is there and was computed.
|
||||
assert.equal(session.$wrapData.length, 2);
|
||||
|
|
@ -390,7 +331,7 @@ var Test = {
|
|||
module.exports = require("asyncjs/test").testcase(Test);
|
||||
});
|
||||
|
||||
if (module === require.main) {
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("../../../support/paths");
|
||||
exports.exec()
|
||||
}
|
||||
|
|
@ -35,10 +35,10 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require("../../../support/paths");
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
EventEmitter = require("pilot/event_emitter").EventEmitter,
|
||||
EventEmitter = require("pilot/event_emitter").EventEmitter,
|
||||
assert = require("./assertions");
|
||||
|
||||
var Emitter = function() {};
|
||||
|
|
@ -61,6 +61,4 @@ var Test = {
|
|||
};
|
||||
|
||||
module.exports = require("asyncjs/test").testcase(Test)
|
||||
|
||||
if (module === require.main)
|
||||
module.exports.exec()
|
||||
});
|
||||
|
|
@ -94,6 +94,19 @@ MockRenderer.prototype.updateCursor = function(position) {
|
|||
this.cursor.column = position.column;
|
||||
};
|
||||
|
||||
MockRenderer.prototype.scrollToLine = function(line, center) {
|
||||
var lineHeight = { lineHeight: 16 };
|
||||
var row = 0;
|
||||
for (var l = 1; l < line; l++) {
|
||||
row += this.session.getRowHeight(lineHeight, l-1) / lineHeight.lineHeight;
|
||||
}
|
||||
|
||||
if (center) {
|
||||
row -= this.visibleRowCount / 2;
|
||||
}
|
||||
this.scrollToRow(row);
|
||||
};
|
||||
|
||||
MockRenderer.prototype.scrollCursorIntoView = function() {
|
||||
if (this.cursor.row < this.layerConfig.firstVisibleRow) {
|
||||
this.scrollToRow(this.cursor.row);
|
||||
|
|
@ -120,12 +133,18 @@ MockRenderer.prototype.draw = function() {
|
|||
MockRenderer.prototype.updateLines = function(startRow, endRow) {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.addMarker = function() {
|
||||
MockRenderer.prototype.updateBackMarkers = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.updateFrontMarkers = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.setBreakpoints = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.onResize = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.updateFull = function() {
|
||||
};
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue