Merge branch 'master' of https://github.com/ajaxorg/ace
This commit is contained in:
commit
0122d07e7c
44 changed files with 1364 additions and 1237 deletions
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;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})
|
||||||
|
|
@ -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
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;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="(?: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(PythonHighlightRules,f),b.PythonHighlightRules=PythonHighlightRules})
|
||||||
|
|
@ -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;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})
|
||||||
|
|
@ -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
12
demo/demo.js
12
demo/demo.js
|
|
@ -84,6 +84,7 @@ exports.launch = function(env) {
|
||||||
}
|
}
|
||||||
docs.plain = new EditSession(loreIpsum);
|
docs.plain = new EditSession(loreIpsum);
|
||||||
docs.plain.setUseWrapMode(true);
|
docs.plain.setUseWrapMode(true);
|
||||||
|
docs.plain.setWrapLimitRange(80, 80)
|
||||||
docs.plain.setMode(new TextMode());
|
docs.plain.setMode(new TextMode());
|
||||||
docs.plain.setUndoManager(new UndoManager());
|
docs.plain.setUndoManager(new UndoManager());
|
||||||
|
|
||||||
|
|
@ -189,7 +190,7 @@ exports.launch = function(env) {
|
||||||
if (!doc.getUseWrapMode()) {
|
if (!doc.getUseWrapMode()) {
|
||||||
wrapModeEl.value = "off";
|
wrapModeEl.value = "off";
|
||||||
} else {
|
} else {
|
||||||
wrapModeEl.value = doc.getWrapLimit();
|
wrapModeEl.value = doc.getWrapLimitRange().min || "free";
|
||||||
}
|
}
|
||||||
env.editor.focus();
|
env.editor.focus();
|
||||||
});
|
});
|
||||||
|
|
@ -220,12 +221,17 @@ exports.launch = function(env) {
|
||||||
break;
|
break;
|
||||||
case "40":
|
case "40":
|
||||||
session.setUseWrapMode(true);
|
session.setUseWrapMode(true);
|
||||||
session.setWrapLimit(40);
|
session.setWrapLimitRange(40, 40);
|
||||||
renderer.setPrintMarginColumn(40);
|
renderer.setPrintMarginColumn(40);
|
||||||
break;
|
break;
|
||||||
case "80":
|
case "80":
|
||||||
session.setUseWrapMode(true);
|
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);
|
renderer.setPrintMarginColumn(80);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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>
|
|
||||||
275
index.html
275
index.html
|
|
@ -1 +1,274 @@
|
||||||
<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="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>
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,14 @@ var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||||
*/
|
*/
|
||||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
this.document = doc;
|
this.document = doc;
|
||||||
this.pos = {
|
|
||||||
row: row,
|
if (typeof column == "undefined")
|
||||||
column: column
|
this.setPosition(row.row, row.column)
|
||||||
};
|
else
|
||||||
doc.on("change", this.onChange.bind(this));
|
this.setPosition(row, column);
|
||||||
|
|
||||||
|
this.$onChange = this.onChange.bind(this);
|
||||||
|
doc.on("change", this.$onChange);
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -58,10 +61,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
this.getPosition = function() {
|
this.getPosition = function() {
|
||||||
return {
|
return this.$clipPositionToDocument(this.row, this.column);
|
||||||
row: this.pos.row,
|
|
||||||
column: this.pos.column
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocument = function() {
|
this.getDocument = function() {
|
||||||
|
|
@ -72,80 +72,103 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||||
var delta = e.data;
|
var delta = e.data;
|
||||||
var range = delta.range;
|
var range = delta.range;
|
||||||
|
|
||||||
if (range.start.row == range.end.row && range.start.row != this.pos.row)
|
if (range.start.row == range.end.row && range.start.row != this.row)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (range.start.row > this.pos.row)
|
if (range.start.row > this.row)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (range.start.row == this.pos.row && range.start.column > this.pos.column)
|
if (range.start.row == this.row && range.start.column > this.column)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.getPosition();
|
var row = this.row;
|
||||||
|
var column = this.column;
|
||||||
|
|
||||||
if (delta.action === "insertText") {
|
if (delta.action === "insertText") {
|
||||||
if (range.start.row === pos.row && range.start.column <= pos.column) {
|
if (range.start.row === row && range.start.column <= column) {
|
||||||
if (range.start.row === range.end.row) {
|
if (range.start.row === range.end.row) {
|
||||||
pos.column += range.end.column - range.start.column;
|
column += range.end.column - range.start.column;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pos.column -= range.start.column;
|
column -= range.start.column;
|
||||||
pos.row += range.end.row - range.start.row;
|
row += range.end.row - range.start.row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (range.start.row !== range.end.row && range.start.row < pos.row) {
|
else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||||
pos.row += range.end.row - range.start.row;
|
row += range.end.row - range.start.row;
|
||||||
}
|
}
|
||||||
} else if (delta.action === "insertLines") {
|
} else if (delta.action === "insertLines") {
|
||||||
if (range.start.row <= pos.row) {
|
if (range.start.row <= row) {
|
||||||
pos.row += range.end.row - range.start.row;
|
row += range.end.row - range.start.row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (delta.action == "removeText") {
|
else if (delta.action == "removeText") {
|
||||||
if (range.start.row == pos.row && range.start.column < pos.column) {
|
if (range.start.row == row && range.start.column < column) {
|
||||||
if (range.end.column >= pos.column)
|
if (range.end.column >= column)
|
||||||
pos.column = range.start.column;
|
column = range.start.column;
|
||||||
else
|
else
|
||||||
pos.column = Math.max(0, pos.column - (range.end.column - range.start.column));
|
column = Math.max(0, column - (range.end.column - range.start.column));
|
||||||
|
|
||||||
} else if (range.start.row !== range.end.row && range.start.row < pos.row) {
|
} else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||||
if (range.end.row == pos.row) {
|
if (range.end.row == row) {
|
||||||
pos.column = Math.max(0, pos.column - range.end.column) + range.start.column;
|
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||||
}
|
}
|
||||||
pos.row -= (range.end.row - range.start.row);
|
row -= (range.end.row - range.start.row);
|
||||||
}
|
}
|
||||||
else if (range.end.row == pos.row) {
|
else if (range.end.row == row) {
|
||||||
pos.row -= range.end.row - range.start.row;
|
row -= range.end.row - range.start.row;
|
||||||
pos.column = Math.max(0, pos.column - range.end.column) + range.start.column;
|
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||||
}
|
}
|
||||||
} else if (delta.action == "removeLines") {
|
} else if (delta.action == "removeLines") {
|
||||||
if (range.start.row <= pos.row) {
|
if (range.start.row <= row) {
|
||||||
if (range.end.row <= pos.row)
|
if (range.end.row <= row)
|
||||||
pos.row -= range.end.row - range.start.row;
|
row -= range.end.row - range.start.row;
|
||||||
else {
|
else {
|
||||||
pos.row = range.start.row;
|
row = range.start.row;
|
||||||
pos.column = 0;
|
column = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clip
|
this.setPosition(row, column);
|
||||||
var len = this.document.getLength();
|
|
||||||
if (pos.row > len) {
|
|
||||||
pos.row = len - 1;
|
|
||||||
pos.column = this.document.getLine(len-1).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setPosition(pos);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setPosition = function(pos) {
|
this.setPosition = function(row, column) {
|
||||||
if (this.pos.row == pos.row && this.pos.column == pos.column)
|
pos = this.$clipPositionToDocument(row, column);
|
||||||
|
if (this.row == pos.row && this.column == pos.column)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.pos = pos;
|
this.row = pos.row;
|
||||||
|
this.column = pos.column;
|
||||||
this._dispatchEvent("change");
|
this._dispatchEvent("change");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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);
|
}).call(Anchor.prototype);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ canon.addCommand({
|
||||||
|
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "selectall",
|
name: "selectall",
|
||||||
exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
|
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||||
});
|
});
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "removeline",
|
name: "removeline",
|
||||||
|
|
@ -253,8 +253,7 @@ canon.addCommand({
|
||||||
canon.addCommand({
|
canon.addCommand({
|
||||||
name: "inserttext",
|
name: "inserttext",
|
||||||
exec: function(env, args, request) {
|
exec: function(env, args, request) {
|
||||||
env.editor.insert(lang.stringRepeat(args.text || "",
|
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||||
args.times || 1));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ var NO_CHANGE_DELTAS = {};
|
||||||
|
|
||||||
var EditSession = function(text, mode) {
|
var EditSession = function(text, mode) {
|
||||||
this.$modified = true;
|
this.$modified = true;
|
||||||
this.selection = new Selection(this);
|
|
||||||
this.$breakpoints = [];
|
this.$breakpoints = [];
|
||||||
this.$wrapData = [];
|
this.$wrapData = [];
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
|
|
@ -60,6 +59,7 @@ var EditSession = function(text, mode) {
|
||||||
this.setDocument(new Document(text));
|
this.setDocument(new Document(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.selection = new Selection(this);
|
||||||
if (mode)
|
if (mode)
|
||||||
this.setMode(mode);
|
this.setMode(mode);
|
||||||
};
|
};
|
||||||
|
|
@ -483,52 +483,10 @@ var EditSession = function(text, mode) {
|
||||||
return this.doc.insert(position, text);
|
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) {
|
this.remove = function(range) {
|
||||||
return this.doc.remove(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) {
|
this.undoChanges = function(deltas) {
|
||||||
if (!deltas.length)
|
if (!deltas.length)
|
||||||
return;
|
return;
|
||||||
|
|
@ -576,7 +534,6 @@ var EditSession = function(text, mode) {
|
||||||
for (var row=startRow; row<=endRow; row++) {
|
for (var row=startRow; row<=endRow; row++) {
|
||||||
this.insert({row: row, column:0}, indentString);
|
this.insert({row: row, column:0}, indentString);
|
||||||
}
|
}
|
||||||
return indentString.length;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.outdentRows = function (range) {
|
this.outdentRows = function (range) {
|
||||||
|
|
@ -599,13 +556,8 @@ var EditSession = function(text, mode) {
|
||||||
deleteRange.start.column = 0;
|
deleteRange.start.column = 0;
|
||||||
deleteRange.end.column = j;
|
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);
|
this.remove(deleteRange);
|
||||||
}
|
}
|
||||||
return range;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveLinesUp = function(firstRow, lastRow) {
|
this.moveLinesUp = function(firstRow, lastRow) {
|
||||||
|
|
@ -642,6 +594,10 @@ var EditSession = function(text, mode) {
|
||||||
// WRAPMODE
|
// WRAPMODE
|
||||||
this.$wrapLimit = 80;
|
this.$wrapLimit = 80;
|
||||||
this.$useWrapMode = false;
|
this.$useWrapMode = false;
|
||||||
|
this.$wrapLimitRange = {
|
||||||
|
min : null,
|
||||||
|
max : null
|
||||||
|
};
|
||||||
|
|
||||||
this.setUseWrapMode = function(useWrapMode) {
|
this.setUseWrapMode = function(useWrapMode) {
|
||||||
if (useWrapMode != this.$useWrapMode) {
|
if (useWrapMode != this.$useWrapMode) {
|
||||||
|
|
@ -666,21 +622,61 @@ var EditSession = function(text, mode) {
|
||||||
return this.$useWrapMode;
|
return this.$useWrapMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setWrapLimit = function(wrapLimit) {
|
// Allow the wrap limit to move freely between min and max. Either
|
||||||
if (wrapLimit != this.$wrapLimit) {
|
// parameter can be null to allow the wrap limit to be unconstrained
|
||||||
this.$wrapLimit = wrapLimit;
|
// 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;
|
this.$modified = true;
|
||||||
if (this.$useWrapMode) {
|
// This will force a recalculation of the wrap limit
|
||||||
this.$updateWrapData(0, this.getLength() - 1);
|
|
||||||
}
|
|
||||||
this._dispatchEvent("changeWrapMode");
|
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() {
|
this.getWrapLimit = function() {
|
||||||
return this.$wrapLimit;
|
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) {
|
this.$updateWrapDataOnChange = function(e) {
|
||||||
if (!this.$useWrapMode) {
|
if (!this.$useWrapMode) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.$selectionMarker = null;
|
this.$selectionMarker = null;
|
||||||
this.$highlightLineMarker = null;
|
this.$highlightLineMarker = null;
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling = 0;
|
||||||
|
|
||||||
this.$search = new Search().set({
|
this.$search = new Search().set({
|
||||||
wrap: true
|
wrap: true
|
||||||
|
|
@ -126,6 +126,7 @@ var Editor =function(renderer, session) {
|
||||||
this.session.removeEventListener("change", this.$onDocumentChange);
|
this.session.removeEventListener("change", this.$onDocumentChange);
|
||||||
this.session.removeEventListener("changeMode", this.$onDocumentModeChange);
|
this.session.removeEventListener("changeMode", this.$onDocumentModeChange);
|
||||||
this.session.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
this.session.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||||
|
this.session.removeEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||||
this.session.removeEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
this.session.removeEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||||
this.session.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
this.session.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||||
this.session.removeEventListener("changeAnnotation", this.$onDocumentChangeAnnotation);
|
this.session.removeEventListener("changeAnnotation", this.$onDocumentChangeAnnotation);
|
||||||
|
|
@ -149,6 +150,9 @@ var Editor =function(renderer, session) {
|
||||||
this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
||||||
session.addEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
session.addEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||||
|
|
||||||
|
this.$onDocumentChangeWrapLimit = this.onDocumentChangeWrapLimit.bind(this);
|
||||||
|
session.addEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||||
|
|
||||||
this.$onDocumentChangeWrapMode = this.onDocumentChangeWrapMode.bind(this);
|
this.$onDocumentChangeWrapMode = this.onDocumentChangeWrapMode.bind(this);
|
||||||
session.addEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
session.addEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||||
|
|
||||||
|
|
@ -281,7 +285,7 @@ var Editor =function(renderer, session) {
|
||||||
this.onCursorChange = function(e) {
|
this.onCursorChange = function(e) {
|
||||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||||
|
|
||||||
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
this.renderer.scrollCursorIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,11 +352,15 @@ var Editor =function(renderer, session) {
|
||||||
this.renderer.setTokenizer(this.bgTokenizer);
|
this.renderer.setTokenizer(this.bgTokenizer);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onDocumentChangeWrapMode = function() {
|
this.onDocumentChangeWrapLimit = function() {
|
||||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||||
this.renderer.updateFull();
|
this.renderer.updateFull();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.onDocumentChangeWrapMode = function() {
|
||||||
|
this.renderer.onResize(true);
|
||||||
|
};
|
||||||
|
|
||||||
this.getCopyText = function() {
|
this.getCopyText = function() {
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
return this.session.getTextRange(this.getSelectionRange());
|
return this.session.getTextRange(this.getSelectionRange());
|
||||||
|
|
@ -367,7 +375,7 @@ var Editor =function(renderer, session) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
this.session.remove(this.getSelectionRange())
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -397,14 +405,6 @@ var Editor =function(renderer, session) {
|
||||||
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
|
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
|
||||||
var end = this.session.insert(cursor, text);
|
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;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
var lineState = this.bgTokenizer.getState(cursor.row);
|
var lineState = this.bgTokenizer.getState(cursor.row);
|
||||||
// multi line insert
|
// multi line insert
|
||||||
if (cursor.row !== end.row) {
|
if (cursor.row !== end.row) {
|
||||||
|
|
@ -437,15 +437,12 @@ var Editor =function(renderer, session) {
|
||||||
outdent -= 1;
|
outdent -= 1;
|
||||||
this.session.replace(new Range(row, 0, row, line.length), line.substr(i));
|
this.session.replace(new Range(row, 0, row, line.length), line.substr(i));
|
||||||
}
|
}
|
||||||
end.column += this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||||
} else {
|
} else {
|
||||||
if (shouldOutdent) {
|
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) {
|
this.onTextInput = function(text) {
|
||||||
|
|
@ -462,9 +459,9 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.$overwrite = overwrite;
|
this.$overwrite = overwrite;
|
||||||
|
|
||||||
this.$blockScrolling = true;
|
this.$blockScrolling += 1;
|
||||||
this.onCursorChange();
|
this.onCursorChange();
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling -= 1;
|
||||||
|
|
||||||
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
||||||
};
|
};
|
||||||
|
|
@ -553,7 +550,7 @@ var Editor =function(renderer, session) {
|
||||||
if (this.selection.isEmpty()) {
|
if (this.selection.isEmpty()) {
|
||||||
this.selection.selectRight();
|
this.selection.selectRight();
|
||||||
}
|
}
|
||||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
this.session.remove(this.getSelectionRange())
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -564,7 +561,7 @@ var Editor =function(renderer, session) {
|
||||||
if (this.selection.isEmpty())
|
if (this.selection.isEmpty())
|
||||||
this.selection.selectLeft();
|
this.selection.selectLeft();
|
||||||
|
|
||||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
this.session.remove(this.getSelectionRange());
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -577,9 +574,7 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
if (range.start.row < range.end.row || range.start.column < range.end.column) {
|
if (range.start.row < range.end.row || range.start.column < range.end.column) {
|
||||||
var rows = this.$getSelectedRows();
|
var rows = this.$getSelectedRows();
|
||||||
var count = session.indentRows(rows.first, rows.last, "\t");
|
session.indentRows(rows.first, rows.last, "\t");
|
||||||
|
|
||||||
this.selection.shiftSelection(count);
|
|
||||||
} else {
|
} else {
|
||||||
var indentString;
|
var indentString;
|
||||||
|
|
||||||
|
|
@ -601,9 +596,7 @@ var Editor =function(renderer, session) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var selection = this.session.getSelection();
|
var selection = this.session.getSelection();
|
||||||
var range = this.session.outdentRows(selection.getRange());
|
this.session.outdentRows(selection.getRange());
|
||||||
|
|
||||||
selection.setSelectionRange(range, selection.isBackwards());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggleCommentLines = function() {
|
this.toggleCommentLines = function() {
|
||||||
|
|
@ -612,8 +605,7 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
||||||
var rows = this.$getSelectedRows()
|
var rows = this.$getSelectedRows()
|
||||||
var addedColumns = this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||||
this.selection.shiftSelection(addedColumns);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeLines = function() {
|
this.removeLines = function() {
|
||||||
|
|
@ -621,10 +613,7 @@ var Editor =function(renderer, session) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var rows = this.$getSelectedRows();
|
var rows = this.$getSelectedRows();
|
||||||
this.selection.setSelectionAnchor(rows.last+1, 0);
|
this.session.remove(new Range(rows.first, 0, rows.last+1, 0));
|
||||||
this.selection.selectTo(rows.first, 0);
|
|
||||||
|
|
||||||
this.session.remove(this.getSelectionRange());
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -689,7 +678,6 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.onCompositionStart = function(text) {
|
this.onCompositionStart = function(text) {
|
||||||
this.renderer.showComposition(this.getCursorPosition());
|
this.renderer.showComposition(this.getCursorPosition());
|
||||||
//this.onTextInput(text);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onCompositionUpdate = function(text) {
|
this.onCompositionUpdate = function(text) {
|
||||||
|
|
@ -698,7 +686,6 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.onCompositionEnd = function() {
|
this.onCompositionEnd = function() {
|
||||||
this.renderer.hideComposition();
|
this.renderer.hideComposition();
|
||||||
//this.removeLeft();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -782,6 +769,9 @@ var Editor =function(renderer, session) {
|
||||||
this.renderer.scrollToRow(row);
|
this.renderer.scrollToRow(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.scrollToLine = function(line, center) {
|
||||||
|
this.renderer.scrollToLine(line, center);
|
||||||
|
};
|
||||||
|
|
||||||
this.getCursorPosition = function() {
|
this.getCursorPosition = function() {
|
||||||
return this.selection.getCursor();
|
return this.selection.getCursor();
|
||||||
|
|
@ -791,6 +781,13 @@ var Editor =function(renderer, session) {
|
||||||
return this.selection.getRange();
|
return this.selection.getRange();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.selectAll = function() {
|
||||||
|
this.$blockScrolling += 1;
|
||||||
|
this.selection.selectAll();
|
||||||
|
this.$blockScrolling -= 1;
|
||||||
|
};
|
||||||
|
|
||||||
this.clearSelection = function() {
|
this.clearSelection = function() {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
@ -807,12 +804,12 @@ var Editor =function(renderer, session) {
|
||||||
this.gotoLine = function(lineNumber, row) {
|
this.gotoLine = function(lineNumber, row) {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
|
|
||||||
this.$blockScrolling = true;
|
this.$blockScrolling += 1;
|
||||||
this.moveCursorTo(lineNumber-1, row || 0);
|
this.moveCursorTo(lineNumber-1, row || 0);
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling -= 1;
|
||||||
|
|
||||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||||
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));
|
this.scrollToLine(lineNumber, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ StateHandler.prototype = {
|
||||||
// If we pressed any command key but no other key, then ignore the input.
|
// 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"
|
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
|
||||||
// which results in "shift-shift-g" which doesn't make senese.
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ var Text = function(parentEl) {
|
||||||
var style = measureNode.style;
|
var style = measureNode.style;
|
||||||
|
|
||||||
style.width = style.height = "auto";
|
style.width = style.height = "auto";
|
||||||
style.left = style.top = "-1000px";
|
style.left = style.top = (-n * 40) + "px";
|
||||||
|
|
||||||
style.visibility = "hidden";
|
style.visibility = "hidden";
|
||||||
style.position = "absolute";
|
style.position = "absolute";
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
||||||
var deleteRange = new Range(0, 0, 0, 0);
|
var deleteRange = new Range(0, 0, 0, 0);
|
||||||
for (var i=startRow; i<= endRow; i++)
|
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.start.row = i;
|
||||||
deleteRange.end.row = i;
|
deleteRange.end.row = i;
|
||||||
deleteRange.end.column = line.length + 2;
|
deleteRange.end.column = m[0].length;
|
||||||
doc.replace(deleteRange, line);
|
doc.replace(deleteRange, m[1]);
|
||||||
}
|
}
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return doc.indentRows(startRow, endRow, "//");
|
doc.indentRows(startRow, endRow, "//");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -37,52 +37,63 @@
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
var Tokenizer = require("ace/tokenizer").Tokenizer
|
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||||
, Rules = require("ace/mode/coffee_highlight_rules").CoffeeHighlightRules
|
var Rules = require("ace/mode/coffee_highlight_rules").CoffeeHighlightRules;
|
||||||
, Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent
|
var Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||||
, Range = require("ace/range").Range
|
var Range = require("ace/range").Range;
|
||||||
;
|
var TextMode = require("ace/mode/text").Mode;
|
||||||
require("pilot/oop").inherits(CoffeeMode, require("ace/mode/text").Mode);
|
var oop = require("pilot/oop")
|
||||||
|
|
||||||
function CoffeeMode() {
|
function CoffeeMode() {
|
||||||
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
||||||
this.$outdent = new Outdent();
|
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*$/
|
oop.inherits(CoffeeMode, TextMode);
|
||||||
, commentLine = /^(\s*)#/
|
|
||||||
, hereComment = /^\s*###(?!#)/
|
var proto = CoffeeMode.prototype;
|
||||||
, indentation = /^\s*/
|
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
|
||||||
;
|
var commentLine = /^(\s*)#/;
|
||||||
proto.getNextLineIndent = function(state, line, tab){
|
var hereComment = /^\s*###(?!#)/;
|
||||||
var indent = this.$getIndent(line)
|
var indentation = /^\s*/;
|
||||||
, tokens = this.$tokenizer.getLineTokens(line, state).tokens
|
|
||||||
;
|
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') &&
|
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||||
state === 'start' && indenter.test(line))
|
state === 'start' && indenter.test(line))
|
||||||
indent += tab;
|
indent += tab;
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
proto.toggleCommentLines = function(state, doc, startRow, endRow){
|
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) {
|
for (var i = startRow; i <= endRow; ++i) {
|
||||||
var line = doc.getLine(i);
|
var line = doc.getLine(i);
|
||||||
if (hereComment.test(line)) continue;
|
if (hereComment.test(line))
|
||||||
line = (out = commentLine.test(line))
|
continue;
|
||||||
? line.replace(commentLine, '$1')
|
|
||||||
: line.replace(indentation, '$&#');
|
if (commentLine.test(line))
|
||||||
|
line = line.replace(commentLine, '$1');
|
||||||
|
else
|
||||||
|
line = line.replace(indentation, '$&#');
|
||||||
|
|
||||||
range.end.row = range.start.row = i;
|
range.end.row = range.start.row = i;
|
||||||
range.end.column = line.length + 1;
|
range.end.column = line.length + 1;
|
||||||
doc.replace(range, line);
|
doc.replace(range, line);
|
||||||
}
|
}
|
||||||
return 1 - out * 2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
proto.checkOutdent = function(state, line, input) {
|
proto.checkOutdent = function(state, line, input) {
|
||||||
return this.$outdent.checkOutdent(line, input);
|
return this.$outdent.checkOutdent(line, input);
|
||||||
};
|
};
|
||||||
|
|
||||||
proto.autoOutdent = function(state, doc, row) {
|
proto.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Mode = CoffeeMode;
|
exports.Mode = CoffeeMode;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -73,7 +73,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ oop.inherits(Mode, TextMode);
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||||
return this.$delegate("toggleCommentLines", arguments, function() {
|
this.$delegate("toggleCommentLines", arguments, function() {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -74,7 +74,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$delegate("autoOutdent", arguments);
|
this.$delegate("autoOutdent", arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$delegate = function(method, args, defaultHandler) {
|
this.$delegate = function(method, args, defaultHandler) {
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
||||||
var deleteRange = new Range(0, 0, 0, 0);
|
var deleteRange = new Range(0, 0, 0, 0);
|
||||||
for (var i=startRow; i<= endRow; i++)
|
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.start.row = i;
|
||||||
deleteRange.end.row = i;
|
deleteRange.end.row = i;
|
||||||
deleteRange.end.column = line.length + 2;
|
deleteRange.end.column = m[0].length;
|
||||||
doc.replace(deleteRange, line);
|
doc.replace(deleteRange, m[1]);
|
||||||
}
|
}
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return doc.indentRows(startRow, endRow, "//");
|
doc.indentRows(startRow, endRow, "//");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWorker = function(session) {
|
this.createWorker = function(session) {
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@ var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
|
||||||
return indent.length - (column-1);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$getIndent = function(line) {
|
this.$getIndent = function(line) {
|
||||||
|
|
|
||||||
|
|
@ -68,16 +68,16 @@ oop.inherits(Mode, TextMode);
|
||||||
var deleteRange = new Range(0, 0, 0, 0);
|
var deleteRange = new Range(0, 0, 0, 0);
|
||||||
for (var i=startRow; i<= endRow; i++)
|
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.start.row = i;
|
||||||
deleteRange.end.row = i;
|
deleteRange.end.row = i;
|
||||||
deleteRange.end.column = line.length + 2;
|
deleteRange.end.column = m[0].length;
|
||||||
doc.replace(deleteRange, line);
|
doc.replace(deleteRange, m[1]);
|
||||||
}
|
}
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return doc.indentRows(startRow, endRow, "#");
|
doc.indentRows(startRow, endRow, "#");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -472,6 +472,10 @@ PhpHighlightRules = function() {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : "\\/\\/.*$"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*$"
|
||||||
|
},
|
||||||
docComment.getStartRule("doc-start"),
|
docComment.getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
||||||
var deleteRange = new Range(0, 0, 0, 0);
|
var deleteRange = new Range(0, 0, 0, 0);
|
||||||
for (var i=startRow; i<= endRow; i++)
|
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.start.row = i;
|
||||||
deleteRange.end.row = i;
|
deleteRange.end.row = i;
|
||||||
deleteRange.end.column = line.length + 2;
|
deleteRange.end.column = m[0].length;
|
||||||
doc.replace(deleteRange, line);
|
doc.replace(deleteRange, m[1]);
|
||||||
}
|
}
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return doc.indentRows(startRow, endRow, "#");
|
doc.indentRows(startRow, endRow, "#");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ PythonHighlightRules = function() {
|
||||||
("").split("|")
|
("").split("|")
|
||||||
);
|
);
|
||||||
|
|
||||||
var strPre = "(?:(?:[rubRUB])|(?:[ubUB][rR]))?";
|
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||||
|
|
||||||
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
var octInteger = "(?:0[oO]?[0-7]+)";
|
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||||
|
|
@ -93,24 +93,24 @@ PythonHighlightRules = function() {
|
||||||
regex : "#.*$"
|
regex : "#.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // """ string
|
token : "string", // """ string
|
||||||
regex : strPre + '"{3}(?:(?:.)|(?:^"{3}))*?"{3}'
|
regex : strPre + '"{3}(?:[^\\\\]|\\\\.)*?"{3}'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line """ string start
|
token : "string", // multi line """ string start
|
||||||
regex : strPre + '"{3}.*$',
|
regex : strPre + '"{3}.*$',
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // " string
|
token : "string", // " string
|
||||||
regex : strPre + '"(?:(?:\\\\.)|(?:[^"\\\\]))*?"'
|
regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // ''' string
|
token : "string", // ''' string
|
||||||
regex : strPre + "'{3}(?:(?:.)|(?:^'{3}))*?'{3}"
|
regex : strPre + "'{3}(?:[^\\\\]|\\\\.)*?'{3}"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line ''' string start
|
token : "string", // multi line ''' string start
|
||||||
regex : strPre + "'{3}.*$",
|
regex : strPre + "'{3}.*$",
|
||||||
next : "qstring"
|
next : "qstring"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // ' string
|
token : "string", // ' string
|
||||||
regex : strPre + "'(?:(?:\\\\.)|(?:[^'\\\\]))*?'"
|
regex : strPre + "'(?:[^\\\\]|\\\\.)*?'"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // imaginary
|
token : "constant.numeric", // imaginary
|
||||||
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||||
|
|
@ -153,8 +153,8 @@ PythonHighlightRules = function() {
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
} ],
|
} ],
|
||||||
"qqstring" : [ {
|
"qqstring" : [ {
|
||||||
token : "string", // multi line """ string end
|
token : "string", // multi line """ string end
|
||||||
regex : '(?:^"{3})*?"{3}',
|
regex : '(?:[^\\\\]|\\\\.)*?"{3}',
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -162,7 +162,7 @@ PythonHighlightRules = function() {
|
||||||
} ],
|
} ],
|
||||||
"qstring" : [ {
|
"qstring" : [ {
|
||||||
token : "string", // multi line ''' string end
|
token : "string", // multi line ''' string end
|
||||||
regex : "(?:^'{3})*?'{3}",
|
regex : "(?:[^\\\\]|\\\\.)*?'{3}",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,16 @@ oop.inherits(Mode, TextMode);
|
||||||
var deleteRange = new Range(0, 0, 0, 0);
|
var deleteRange = new Range(0, 0, 0, 0);
|
||||||
for (var i=startRow; i<= endRow; i++)
|
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.start.row = i;
|
||||||
deleteRange.end.row = i;
|
deleteRange.end.row = i;
|
||||||
deleteRange.end.column = line.length + 2;
|
deleteRange.end.column = m[0].length;
|
||||||
doc.replace(deleteRange, line);
|
doc.replace(deleteRange, m[1]);
|
||||||
}
|
}
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return doc.indentRows(startRow, endRow, "#");
|
doc.indentRows(startRow, endRow, "#");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ oop.inherits(Mode, TextMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoOutdent = function(state, doc, row) {
|
this.autoOutdent = function(state, doc, row) {
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ var Mode = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||||
return 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
|
|
||||||
|
|
@ -42,15 +42,27 @@ var oop = require("pilot/oop");
|
||||||
var lang = require("pilot/lang");
|
var lang = require("pilot/lang");
|
||||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||||
var Range = require("ace/range").Range;
|
var Range = require("ace/range").Range;
|
||||||
|
var Anchor = require("ace/anchor").Anchor;
|
||||||
|
|
||||||
var Selection = function(doc) {
|
var Selection = function(session) {
|
||||||
this.doc = doc;
|
this.session = session;
|
||||||
|
this.doc = session.getDocument();
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selectionLead = {
|
this.selectionLead = new Anchor(this.doc, 0, 0);
|
||||||
row: 0,
|
this.selectionAnchor = new Anchor(this.doc, 0, 0);
|
||||||
column: 0
|
|
||||||
};
|
var _self = this;
|
||||||
|
this.selectionLead.on("change", function() {
|
||||||
|
_self._dispatchEvent("changeCursor");
|
||||||
|
if (!_self.$isEmpty)
|
||||||
|
_self._dispatchEvent("changeSelection");
|
||||||
|
});
|
||||||
|
|
||||||
|
this.selectionAnchor.on("change", function() {
|
||||||
|
if (!_self.$isEmpty)
|
||||||
|
_self._dispatchEvent("changeSelection");
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -58,9 +70,10 @@ var Selection = function(doc) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (!this.selectionAnchor ||
|
return (this.$isEmpty || (
|
||||||
(this.selectionAnchor.row == this.selectionLead.row &&
|
this.selectionAnchor.row == this.selectionLead.row &&
|
||||||
this.selectionAnchor.column == this.selectionLead.column));
|
this.selectionAnchor.column == this.selectionLead.column
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isMultiLine = function() {
|
this.isMultiLine = function() {
|
||||||
|
|
@ -72,37 +85,31 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getCursor = function() {
|
this.getCursor = function() {
|
||||||
return this.selectionLead;
|
return this.selectionLead.getPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSelectionAnchor = function(row, column) {
|
this.setSelectionAnchor = function(row, column) {
|
||||||
var anchor = this.$clipPositionToDocument(row, column);
|
this.selectionAnchor.setPosition(row, column);
|
||||||
|
|
||||||
if (!this.selectionAnchor) {
|
if (this.$isEmpty) {
|
||||||
this.selectionAnchor = anchor;
|
this.$isEmpty = false;
|
||||||
this._dispatchEvent("changeSelection", {});
|
this._dispatchEvent("changeSelection");
|
||||||
}
|
}
|
||||||
else if (this.selectionAnchor.row !== anchor.row || this.selectionAnchor.column !== anchor.column) {
|
|
||||||
this.selectionAnchor = anchor;
|
|
||||||
this._dispatchEvent("changeSelection", {});
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getSelectionAnchor = function() {
|
this.getSelectionAnchor = function() {
|
||||||
if (this.selectionAnchor) {
|
if (this.$isEmpty)
|
||||||
return this.$clone(this.selectionAnchor);
|
return this.getSelectionLead()
|
||||||
} else {
|
else
|
||||||
return this.$clone(this.selectionLead);
|
return this.selectionAnchor.getPosition();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getSelectionLead = function() {
|
this.getSelectionLead = function() {
|
||||||
return this.$clone(this.selectionLead);
|
return this.selectionLead.getPosition();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.shiftSelection = function(columns) {
|
this.shiftSelection = function(columns) {
|
||||||
if (this.isEmpty()) {
|
if (this.$isEmpty) {
|
||||||
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
@ -123,15 +130,18 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isBackwards = function() {
|
this.isBackwards = function() {
|
||||||
var anchor = this.selectionAnchor || this.selectionLead;
|
var anchor = this.selectionAnchor;
|
||||||
var lead = this.selectionLead;
|
var lead = this.selectionLead;
|
||||||
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
|
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getRange = function() {
|
this.getRange = function() {
|
||||||
var anchor = this.selectionAnchor || this.selectionLead;
|
var anchor = this.selectionAnchor;
|
||||||
var lead = this.selectionLead;
|
var lead = this.selectionLead;
|
||||||
|
|
||||||
|
if (this.isEmpty())
|
||||||
|
return Range.fromPoints(lead, lead);
|
||||||
|
|
||||||
if (this.isBackwards()) {
|
if (this.isBackwards()) {
|
||||||
return Range.fromPoints(lead, anchor);
|
return Range.fromPoints(lead, anchor);
|
||||||
}
|
}
|
||||||
|
|
@ -141,26 +151,16 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clearSelection = function() {
|
this.clearSelection = function() {
|
||||||
if (this.selectionAnchor) {
|
if (!this.$isEmpty) {
|
||||||
this.selectionAnchor = null;
|
this.$isEmpty = true;
|
||||||
this._dispatchEvent("changeSelection", {});
|
this._dispatchEvent("changeSelection");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectAll = function() {
|
this.selectAll = function() {
|
||||||
var lastRow = this.doc.getLength() - 1;
|
var lastRow = this.doc.getLength() - 1;
|
||||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||||
|
this.moveCursorTo(0, 0);
|
||||||
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.setSelectionRange = function(range, reverse) {
|
this.setSelectionRange = function(range, reverse) {
|
||||||
|
|
@ -177,27 +177,16 @@ var Selection = function(doc) {
|
||||||
this.$updateDesiredColumn = function() {
|
this.$updateDesiredColumn = function() {
|
||||||
var cursor = this.getCursor();
|
var cursor = this.getCursor();
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
this.$desiredColumn = this.doc.documentToScreenColumn(cursor.row, cursor.column);
|
this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$moveSelection = function(mover) {
|
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);
|
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) {
|
this.selectTo = function(row, column) {
|
||||||
|
|
@ -253,15 +242,9 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectWord = function() {
|
this.selectWord = function() {
|
||||||
var cursor = this.selectionLead;
|
var cursor = this.getCursor();
|
||||||
var column = cursor.column;
|
var range = this.session.getWordRange(cursor.row, cursor.column);
|
||||||
var range = this.doc.getWordRange(cursor.row, column);
|
|
||||||
this.setSelectionRange(range);
|
this.setSelectionRange(range);
|
||||||
|
|
||||||
/*this.setSelectionAnchor(cursor.row, start);
|
|
||||||
this.$moveSelection(function() {
|
|
||||||
this.moveCursorTo(cursor.row, end);
|
|
||||||
});*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectLine = function() {
|
this.selectLine = function() {
|
||||||
|
|
@ -280,18 +263,16 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorLeft = function() {
|
this.moveCursorLeft = function() {
|
||||||
if (this.selectionLead.column == 0) {
|
var cursor = this.selectionLead.getPosition();
|
||||||
|
if (cursor.column == 0) {
|
||||||
// cursor is a line (start
|
// cursor is a line (start
|
||||||
if (this.selectionLead.row > 0) {
|
if (cursor.row > 0) {
|
||||||
this.moveCursorTo(this.selectionLead.row - 1, this.doc
|
this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
|
||||||
.getLine(this.selectionLead.row - 1).length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var doc = this.doc;
|
var tabSize = this.session.getTabSize();
|
||||||
var tabSize = doc.getTabSize();
|
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
|
||||||
var cursor = this.selectionLead;
|
|
||||||
if (doc.isTabStop(cursor) && doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
|
|
||||||
this.moveCursorBy(0, -tabSize);
|
this.moveCursorBy(0, -tabSize);
|
||||||
else
|
else
|
||||||
this.moveCursorBy(0, -1);
|
this.moveCursorBy(0, -1);
|
||||||
|
|
@ -305,10 +286,9 @@ var Selection = function(doc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var doc = this.doc;
|
var tabSize = this.session.getTabSize();
|
||||||
var tabSize = doc.getTabSize();
|
|
||||||
var cursor = this.selectionLead;
|
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);
|
this.moveCursorBy(0, tabSize);
|
||||||
else
|
else
|
||||||
this.moveCursorBy(0, 1);
|
this.moveCursorBy(0, 1);
|
||||||
|
|
@ -318,12 +298,12 @@ var Selection = function(doc) {
|
||||||
this.moveCursorLineStart = function() {
|
this.moveCursorLineStart = function() {
|
||||||
var row = this.selectionLead.row;
|
var row = this.selectionLead.row;
|
||||||
var column = this.selectionLead.column;
|
var column = this.selectionLead.column;
|
||||||
var screenRow = this.doc.documentToScreenRow(row, column);
|
var screenRow = this.session.documentToScreenRow(row, column);
|
||||||
var firstRowColumn = this.doc.getScreenFirstRowColumn(screenRow);
|
var firstRowColumn = this.session.getScreenFirstRowColumn(screenRow);
|
||||||
var beforeCursor = this.doc.getLine(row).slice(firstRowColumn, column);
|
var beforeCursor = this.doc.getLine(row).slice(firstRowColumn, column);
|
||||||
var leadingSpace = beforeCursor.match(/^\s*/);
|
var leadingSpace = beforeCursor.match(/^\s*/);
|
||||||
if (leadingSpace[0].length == 0) {
|
if (leadingSpace[0].length == 0) {
|
||||||
var lastRowColumn = this.doc.getDocumentLastRowColumn(row, column);
|
var lastRowColumn = this.session.getDocumentLastRowColumn(row, column);
|
||||||
leadingSpace = this.doc.getLine(row).
|
leadingSpace = this.doc.getLine(row).
|
||||||
substring(firstRowColumn, lastRowColumn).
|
substring(firstRowColumn, lastRowColumn).
|
||||||
match(/^\s*/);
|
match(/^\s*/);
|
||||||
|
|
@ -336,9 +316,8 @@ var Selection = function(doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorLineEnd = function() {
|
this.moveCursorLineEnd = function() {
|
||||||
var selLead = this.selectionLead;
|
var lead = this.selectionLead;
|
||||||
this.moveCursorTo(selLead.row,
|
this.moveCursorTo(lead.row, this.session.getDocumentLastRowColumn(lead.row, lead.column));
|
||||||
this.doc.getDocumentLastRowColumn(selLead.row, selLead.column));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorFileEnd = function() {
|
this.moveCursorFileEnd = function() {
|
||||||
|
|
@ -358,20 +337,20 @@ var Selection = function(doc) {
|
||||||
var rightOfCursor = line.substring(column);
|
var rightOfCursor = line.substring(column);
|
||||||
|
|
||||||
var match;
|
var match;
|
||||||
this.doc.nonTokenRe.lastIndex = 0;
|
this.session.nonTokenRe.lastIndex = 0;
|
||||||
this.doc.tokenRe.lastIndex = 0;
|
this.session.tokenRe.lastIndex = 0;
|
||||||
|
|
||||||
if (column == line.length) {
|
if (column == line.length) {
|
||||||
this.moveCursorRight();
|
this.moveCursorRight();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (match = this.doc.nonTokenRe.exec(rightOfCursor)) {
|
else if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
|
||||||
column += this.doc.nonTokenRe.lastIndex;
|
column += this.session.nonTokenRe.lastIndex;
|
||||||
this.doc.nonTokenRe.lastIndex = 0;
|
this.session.nonTokenRe.lastIndex = 0;
|
||||||
}
|
}
|
||||||
else if (match = this.doc.tokenRe.exec(rightOfCursor)) {
|
else if (match = this.session.tokenRe.exec(rightOfCursor)) {
|
||||||
column += this.doc.tokenRe.lastIndex;
|
column += this.session.tokenRe.lastIndex;
|
||||||
this.doc.tokenRe.lastIndex = 0;
|
this.session.tokenRe.lastIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
|
|
@ -384,83 +363,49 @@ var Selection = function(doc) {
|
||||||
var leftOfCursor = lang.stringReverse(line.substring(0, column));
|
var leftOfCursor = lang.stringReverse(line.substring(0, column));
|
||||||
|
|
||||||
var match;
|
var match;
|
||||||
this.doc.nonTokenRe.lastIndex = 0;
|
this.session.nonTokenRe.lastIndex = 0;
|
||||||
this.doc.tokenRe.lastIndex = 0;
|
this.session.tokenRe.lastIndex = 0;
|
||||||
|
|
||||||
if (column == 0) {
|
if (column == 0) {
|
||||||
this.moveCursorLeft();
|
this.moveCursorLeft();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (match = this.doc.nonTokenRe.exec(leftOfCursor)) {
|
else if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
|
||||||
column -= this.doc.nonTokenRe.lastIndex;
|
column -= this.session.nonTokenRe.lastIndex;
|
||||||
this.doc.nonTokenRe.lastIndex = 0;
|
this.session.nonTokenRe.lastIndex = 0;
|
||||||
}
|
}
|
||||||
else if (match = this.doc.tokenRe.exec(leftOfCursor)) {
|
else if (match = this.session.tokenRe.exec(leftOfCursor)) {
|
||||||
column -= this.doc.tokenRe.lastIndex;
|
column -= this.session.tokenRe.lastIndex;
|
||||||
this.doc.tokenRe.lastIndex = 0;
|
this.session.tokenRe.lastIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorBy = function(rows, chars) {
|
this.moveCursorBy = function(rows, chars) {
|
||||||
if (this.doc.getUseWrapMode()) {
|
if (this.session.getUseWrapMode()) {
|
||||||
var screenPos = this.doc.documentToScreenPosition(
|
var screenPos = this.session.documentToScreenPosition(
|
||||||
this.selectionLead.row, this.selectionLead.column);
|
this.selectionLead.row,
|
||||||
var screenCol =
|
this.selectionLead.column
|
||||||
(chars == 0 && this.$desiredColumn) || screenPos.column;
|
);
|
||||||
|
var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
|
||||||
|
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||||
|
|
||||||
var docPos = this.doc.screenToDocumentPosition(
|
|
||||||
screenPos.row + rows, screenCol);
|
|
||||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
||||||
} else {
|
} else {
|
||||||
var docColumn =
|
var docColumn = (chars == 0 && this.$desiredColumn) || this.selectionLead.column;
|
||||||
(chars == 0 && this.$desiredColumn) || this.selectionLead.column;
|
this.moveCursorTo(this.selectionLead.row + rows, docColumn + chars, chars == 0);
|
||||||
this.moveCursorTo(
|
|
||||||
this.selectionLead.row + rows, docColumn + chars, chars == 0);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.moveCursorToPosition = function(position) {
|
this.moveCursorToPosition = function(position) {
|
||||||
this.moveCursorTo(position.row, position.column);
|
this.moveCursorTo(position.row, position.column);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
|
this.moveCursorTo = function(row, column, preventUpdateDesiredColumn) {
|
||||||
var cursor = this.$clipPositionToDocument(row, column);
|
this.selectionLead.setPosition(row, column);
|
||||||
|
if (!preventUpdateDesiredColumn)
|
||||||
// only dispatch change if the cursor actually changed
|
this.$updateDesiredColumn(this.selectionLead.column);
|
||||||
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.$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;
|
|
||||||
}
|
|
||||||
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
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(Selection.prototype);
|
}).call(Selection.prototype);
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ var Test = {
|
||||||
var anchor = new Anchor(doc, 1, 4);
|
var anchor = new Anchor(doc, 1, 4);
|
||||||
|
|
||||||
doc.remove(new Range(1, 4, 1, 5));
|
doc.remove(new Range(1, 4, 1, 5));
|
||||||
console.log(doc.$lines);
|
|
||||||
assert.position(anchor.getPosition(), 1, 4);
|
assert.position(anchor.getPosition(), 1, 4);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
|
require("./mockdom");
|
||||||
|
|
||||||
var EditSession = require("ace/edit_session").EditSession,
|
var EditSession = require("ace/edit_session").EditSession,
|
||||||
Editor = require("../editor").Editor,
|
Editor = require("../editor").Editor,
|
||||||
UndoManager = require("ace/undomanager").UndoManager,
|
UndoManager = require("ace/undomanager").UndoManager,
|
||||||
|
|
@ -169,14 +171,17 @@ var Test = {
|
||||||
var wrapLimit = 12;
|
var wrapLimit = 12;
|
||||||
var session = new EditSession(["foo bar foo bar"]);
|
var session = new EditSession(["foo bar foo bar"]);
|
||||||
session.setUseWrapMode(true);
|
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, 11), 0, 11);
|
||||||
assert.position(session.documentToScreenPosition(0, 12), 1, 0);
|
assert.position(session.documentToScreenPosition(0, 12), 1, 0);
|
||||||
|
|
||||||
session = new EditSession(["ぁぁa"]);
|
session = new EditSession(["ぁぁa"]);
|
||||||
session.setUseWrapMode(true);
|
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, 1), 1, 0);
|
||||||
assert.position(session.documentToScreenPosition(0, 2), 2, 0);
|
assert.position(session.documentToScreenPosition(0, 2), 2, 0);
|
||||||
assert.position(session.documentToScreenPosition(0, 4), 2, 1);
|
assert.position(session.documentToScreenPosition(0, 4), 2, 1);
|
||||||
|
|
@ -202,7 +207,8 @@ var Test = {
|
||||||
var wrapLimit = 12;
|
var wrapLimit = 12;
|
||||||
var session = new EditSession(["foo bar foo bar"]);
|
var session = new EditSession(["foo bar foo bar"]);
|
||||||
session.setUseWrapMode(true);
|
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(1, 0), 0, 12);
|
||||||
assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
|
assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
|
||||||
|
|
@ -212,6 +218,8 @@ var Test = {
|
||||||
|
|
||||||
session = new EditSession(["ぁ a"]);
|
session = new EditSession(["ぁ a"]);
|
||||||
session.setUseWrapMode(true);
|
session.setUseWrapMode(true);
|
||||||
|
session.adjustWrapLimit(80);
|
||||||
|
|
||||||
assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
|
assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
|
||||||
assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
|
assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
|
||||||
assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
|
assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
|
||||||
|
|
@ -263,72 +271,6 @@ var Test = {
|
||||||
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
|
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() {
|
"test get longest line" : function() {
|
||||||
var session = new EditSession(["12"]);
|
var session = new EditSession(["12"]);
|
||||||
session.setTabSize(4);
|
session.setTabSize(4);
|
||||||
|
|
@ -378,7 +320,8 @@ var Test = {
|
||||||
var document = session.getDocument();
|
var document = session.getDocument();
|
||||||
|
|
||||||
session.setUseWrapMode(true);
|
session.setUseWrapMode(true);
|
||||||
session.setWrapLimit(3);
|
session.setWrapLimitRange(3, 3);
|
||||||
|
session.adjustWrapLimit(80);
|
||||||
|
|
||||||
// Test if wrapData is there and was computed.
|
// Test if wrapData is there and was computed.
|
||||||
assert.equal(session.$wrapData.length, 2);
|
assert.equal(session.$wrapData.length, 2);
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,9 @@ MockRenderer.prototype.updateCursor = function(position) {
|
||||||
this.cursor.column = position.column;
|
this.cursor.column = position.column;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MockRenderer.prototype.scrollToLine = function(row) {
|
||||||
|
};
|
||||||
|
|
||||||
MockRenderer.prototype.scrollCursorIntoView = function() {
|
MockRenderer.prototype.scrollCursorIntoView = function() {
|
||||||
if (this.cursor.row < this.layerConfig.firstVisibleRow) {
|
if (this.cursor.row < this.layerConfig.firstVisibleRow) {
|
||||||
this.scrollToRow(this.cursor.row);
|
this.scrollToRow(this.cursor.row);
|
||||||
|
|
@ -126,6 +129,9 @@ MockRenderer.prototype.addMarker = function() {
|
||||||
MockRenderer.prototype.setBreakpoints = function() {
|
MockRenderer.prototype.setBreakpoints = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MockRenderer.prototype.onResize = function() {
|
||||||
|
};
|
||||||
|
|
||||||
MockRenderer.prototype.updateFull = function() {
|
MockRenderer.prototype.updateFull = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,9 @@ define(function(require, exports, module) {
|
||||||
.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\
|
.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\
|
||||||
border: 1px solid #FFE300;\
|
border: 1px solid #FFE300;\
|
||||||
background: #766B13;\
|
background: #766B13;\
|
||||||
|
}\
|
||||||
|
.ace-twilight.normal-mode .ace_cursor-layer {\
|
||||||
|
z-index: 0;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_marker-layer .ace_selection {\
|
.ace-twilight .ace_marker-layer .ace_selection {\
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.lineHeight = textLayer.getLineHeight();
|
this.lineHeight = textLayer.getLineHeight();
|
||||||
|
|
||||||
this.$cursorLayer = new CursorLayer(this.content);
|
this.$cursorLayer = new CursorLayer(this.content);
|
||||||
|
this.$cursorPadding = 8;
|
||||||
|
|
||||||
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
||||||
|
|
||||||
|
|
@ -209,6 +210,13 @@ var VirtualRenderer = function(container, theme) {
|
||||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||||
this.scroller.style.left = gutterWidth + "px";
|
this.scroller.style.left = gutterWidth + "px";
|
||||||
this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px";
|
this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px";
|
||||||
|
|
||||||
|
if (this.session.getUseWrapMode()) {
|
||||||
|
var limit = Math.floor(this.scroller.clientWidth / this.characterWidth);
|
||||||
|
if (this.session.adjustWrapLimit(limit) || force) {
|
||||||
|
changes = changes | this.CHANGE_FULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$size.scrollerWidth = this.scroller.clientWidth;
|
this.$size.scrollerWidth = this.scroller.clientWidth;
|
||||||
|
|
@ -489,7 +497,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$getLongestLine = function() {
|
this.$getLongestLine = function() {
|
||||||
var charCount = this.session.getScreenWidth();
|
var charCount = this.session.getScreenWidth() + 1;
|
||||||
if (this.$textLayer.showInvisibles)
|
if (this.$textLayer.showInvisibles)
|
||||||
charCount += 1;
|
charCount += 1;
|
||||||
|
|
||||||
|
|
@ -559,10 +567,12 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.scrollToX(left);
|
this.scrollToX(left);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left
|
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
|
||||||
+ this.characterWidth) {
|
|
||||||
this.scrollToX(Math.round(left + this.characterWidth
|
if (left + this.characterWidth > this.scroller.scrollWidth)
|
||||||
- this.$size.scrollerWidth));
|
this.$renderChanges(this.CHANGE_SIZE);
|
||||||
|
|
||||||
|
this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -582,6 +592,19 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.scrollToY(row * this.lineHeight);
|
this.scrollToY(row * this.lineHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.scrollToLine = function(line, center) {
|
||||||
|
var lineHeight = { lineHeight: this.lineHeight };
|
||||||
|
var offset = 0;
|
||||||
|
for (var l = 1; l < line; l++) {
|
||||||
|
offset += this.session.getRowHeight(lineHeight, l-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (center) {
|
||||||
|
offset -= this.$size.scrollerHeight / 2;
|
||||||
|
}
|
||||||
|
this.scrollToY(offset);
|
||||||
|
};
|
||||||
|
|
||||||
this.scrollToY = function(scrollTop) {
|
this.scrollToY = function(scrollTop) {
|
||||||
var maxHeight = this.session.getScreenLength() * this.lineHeight - this.$size.scrollerHeight;
|
var maxHeight = this.session.getScreenLength() * this.lineHeight - this.$size.scrollerHeight;
|
||||||
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
|
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
|
||||||
|
|
@ -607,9 +630,9 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||||
var canvasPos = this.scroller.getBoundingClientRect();
|
var canvasPos = this.scroller.getBoundingClientRect();
|
||||||
|
|
||||||
var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding)
|
var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
|
||||||
/ this.characterWidth);
|
/ this.characterWidth);
|
||||||
var row = Math.floor((pageY + this.scrollTop - canvasPos.top)
|
var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
|
||||||
/ this.lineHeight);
|
/ this.lineHeight);
|
||||||
|
|
||||||
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
|
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
|
||||||
|
|
@ -637,21 +660,21 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showComposition = function(position) {
|
this.showComposition = function(position) {
|
||||||
if (!this.$composition) {
|
if (!this.$composition) {
|
||||||
this.$composition = document.createElement("div");
|
this.$composition = document.createElement("div");
|
||||||
this.$composition.className = "ace_composition";
|
this.$composition.className = "ace_composition";
|
||||||
this.content.appendChild(this.$composition);
|
this.content.appendChild(this.$composition);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$composition.innerHTML = " ";
|
this.$composition.innerHTML = " ";
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos = this.$cursorLayer.getPixelPosition();
|
||||||
var style = this.$composition.style;
|
var style = this.$composition.style;
|
||||||
style.top = pos.top + "px";
|
style.top = pos.top + "px";
|
||||||
style.left = (pos.left + this.$padding) + "px";
|
style.left = (pos.left + this.$padding) + "px";
|
||||||
style.height = this.lineHeight + "px";
|
style.height = this.lineHeight + "px";
|
||||||
|
|
||||||
this.hideCursor();
|
this.hideCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setCompositionText = function(text) {
|
this.setCompositionText = function(text) {
|
||||||
|
|
@ -659,14 +682,14 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
this.showCursor();
|
this.showCursor();
|
||||||
|
|
||||||
if (!this.$composition)
|
if (!this.$composition)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var style = this.$composition.style;
|
var style = this.$composition.style;
|
||||||
style.top = "-10000px";
|
style.top = "-10000px";
|
||||||
style.left = "-10000px";
|
style.left = "-10000px";
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setTheme = function(theme) {
|
this.setTheme = function(theme) {
|
||||||
|
|
|
||||||
35
static.js
Normal file
35
static.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
var http = require("http"),
|
||||||
|
url = require("url"),
|
||||||
|
path = require("path"),
|
||||||
|
fs = require("fs")
|
||||||
|
port = process.env.C9_PORT || 8888;
|
||||||
|
|
||||||
|
http.createServer(function(request, response) {
|
||||||
|
|
||||||
|
var uri = url.parse(request.url).pathname
|
||||||
|
, filename = path.join(process.cwd(), uri);
|
||||||
|
|
||||||
|
path.exists(filename, function(exists) {
|
||||||
|
if(!exists) {
|
||||||
|
response.writeHead(404, {"Content-Type": "text/plain"});
|
||||||
|
response.write("404 Not Found\n");
|
||||||
|
response.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.statSync(filename).isDirectory()) filename += '/index.html';
|
||||||
|
|
||||||
|
fs.readFile(filename, "binary", function(err, file) {
|
||||||
|
if(err) {
|
||||||
|
response.writeHead(500, {"Content-Type": "text/plain"});
|
||||||
|
response.write(err + "\n");
|
||||||
|
response.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
response.writeHead(200);
|
||||||
|
response.write(file, "binary");
|
||||||
|
response.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).listen(port, "0.0.0.0");
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit c0cab19cbb5d44df98bae0060c782a6f30464afe
|
Subproject commit cbfac498d30d43fdb7687d198c5b752736222c2f
|
||||||
Loading…
Add table
Add a link
Reference in a new issue