This commit is contained in:
William Candillon 2012-06-25 07:36:27 -07:00
commit 9c6da1d56c
65 changed files with 2144 additions and 1587 deletions

2
.gitignore vendored
View file

@ -7,6 +7,7 @@
.project
.settings/
.settings.xml
.settings
.c9settings.xml
.c9revisions
.settings.xml.old
@ -16,7 +17,6 @@
/ignore/
node_modules/
tool/node_modules/
build/
.git-ref
npm-debug.log

5
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "doc/wiki"]
path = doc/wiki
url = git://github.com/ajaxorg/ace.wiki.git
url = git://github.com/ajaxorg/ace.wiki.git
[submodule "build"]
path = build
url = https://github.com/ajaxorg/ace-builds.git

View file

@ -62,8 +62,8 @@ function main(args) {
if (type == "minimal") {
buildAce({
compress: args.indexOf("-m") != -1,
noconflict: args.indexOf("-nc") != -1
compress: args.indexOf("--m") != -1,
noconflict: args.indexOf("--nc") != -1
});
} else if (type == "normal") {
ace();

1
build Submodule

@ -0,0 +1 @@
Subproject commit b5354412bfeb461b7d8020423562451a81da2c85

View file

@ -90,6 +90,7 @@ Mode.prototype.supportsFile = function(filename) {
};
var modesByName = {
c9search: ["C9Search" , "c9search_results"],
coffee: ["CoffeeScript" , "coffee|^Cakefile"],
coldfusion: ["ColdFusion" , "cfm"],
csharp: ["C#" , "cs"],
@ -104,10 +105,12 @@ var modesByName = {
java: ["Java" , "java"],
javascript: ["JavaScript" , "js"],
json: ["JSON" , "json"],
jsx: ["JSX" , "jsx"],
latex: ["LaTeX" , "latex|tex|ltx|bib"],
less: ["LESS" , "less"],
liquid: ["Liquid" , "liquid"],
lua: ["Lua" , "lua"],
luapage: ["LuaPage" , "lp"], // http://keplerproject.github.com/cgilua/manual.html#templates
markdown: ["Markdown" , "md|markdown"],
ocaml: ["OCaml" , "ml|mli"],
perl: ["Perl" , "pl|pm"],
@ -165,6 +168,7 @@ function makeHuge(txt) {
}
var docs = {
"docs/c9search.c9search_results": "C9 Search Results",
"docs/javascript.js": "JavaScript",
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
"docs/coffeescript.coffee": "Coffeescript",
@ -185,6 +189,7 @@ var docs = {
"docs/ocaml.ml": "OCaml",
"docs/OpenSCAD.scad": "OpenSCAD",
"docs/lua.lua": "Lua",
"docs/luapage.lp": "LuaPage",
"docs/liquid.liquid": "Liquid",
"docs/java.java": "Java",
"docs/clojure.clj": "Clojure",
@ -201,7 +206,8 @@ var docs = {
"docs/latex.tex": {name: "LaTeX", wrapped: true},
"docs/sql.sql": {name: "SQL", wrapped: true},
"docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
"docs/golang.go": "Go"
"docs/golang.go": "Go",
"docs/jsx.jsx": "JSX"
}
var ownSource = {

View file

@ -0,0 +1,25 @@
Searching for 'var' in /workspace/configs
configs/default.js:
1: var fs = require("fs");
2: var argv = require('optimist').argv;
3: var path = require("path");
5: var clientExtensions = {};
6: var clientDirs = fs.readdirSync(__dirname + "/../plugins-client");
7: for (var i = 0; i < clientDirs.length; i++) {
8: var dir = clientDirs[i];
12: var name = dir.split(".")[1];
16: var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();
17: var fsUrl = "/workspace";
19: var port = argv.p || process.env.PORT || 3131;
20: var host = argv.l || "localhost";
22: var config = {
configs/local.js:
2: var config = require("./default");
configs/packed.js:
1: var config = require("./default");
Found 15 matches in 3 files

View file

@ -0,0 +1,9 @@
/*EXPECTED
hello world!
*/
class Test {
static function run() : void {
// console.log("hello world!");
log "hello world!";
}
}

View file

@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<% --[[--
index.lp from the Kepler Project's LuaDoc HTML doclet.
http://keplerproject.github.com/luadoc/
--]] %>
<head>
<title>Reference</title>
<link rel="stylesheet" href="<%=luadoc.doclet.html.link("luadoc.css")%>" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<%=luadoc.doclet.html.include("menu.lp", { doc=doc })%>
</div> <!-- id="navigation" -->
<div id="content">
<%if not options.nomodules and #doc.modules > 0 then%>
<h2>Modules</h2>
<table class="module_list">
<!--<tr><td colspan="2">Modules</td></tr>-->
<%for _, modulename in ipairs(doc.modules) do%>
<tr>
<td class="name"><a href="<%=luadoc.doclet.html.module_link(modulename, doc)%>"><%=modulename%></a></td>
<td class="summary"><%=doc.modules[modulename].summary%></td>
</tr>
<%end%>
</table>
<%end%>
<%if not options.nofiles and #doc.files > 0 then%>
<h2>Files</h2>
<table class="file_list">
<!--<tr><td colspan="2">Files</td></tr>-->
<%for _, filepath in ipairs(doc.files) do%>
<tr>
<td class="name"><a href="<%=luadoc.doclet.html.file_link(filepath)%>"><%=filepath%></a></td>
<td class="summary"></td>
</tr>
<%end%>
</table>
<%end%>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -8,9 +8,9 @@
<link href="doc/site/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" media="all and (max-device-width: 480px)" href="doc/site/iphone.css">
<link rel="stylesheet" media="all and (min-device-width: 481px) and (max-device-width: 1024px)" href="doc/site/iphone.css">
<link rel="stylesheet" href="./doc/resources/ace/skeleton/csses/bootstrap.min.css">
<link rel="stylesheet" href="./doc/resources/ace/skeleton/csses/ace_api.css">
<link href="./doc/resources/ace/skeleton/images/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" href="./doc/resources/ace/skeleton/csses/bootstrap.min.css">
<link rel="stylesheet" href="./doc/resources/ace/skeleton/csses/ace_api.css">
<link href="./doc/resources/ace/skeleton/images/favicon.ico" rel="icon" type="image/x-icon">
</head>
<body>
<a href="http://github.com/ajaxorg/ace"><img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/camo.github.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"></a>
@ -57,6 +57,7 @@
<li><a href="http://www.wavemaker.com/">WaveMaker</a></li>
<li><a href="http://rstudio.org/">RStudio</a></li>
<li><a href="http://www.playmycode.com/">Play My Code</a></li>
<li><a href="http://www.codecademy.com/">Codecademy</a></li>
<li><a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a></li>
<li><a href="http://ext.radiantcms.org/extensions/264-ace">Radiant CMS</a></li>
<li><a href="http://developercompanion.com/">Developer Companion</a></li>

View file

@ -67,6 +67,7 @@
<option value="ace/theme/dawn">Dawn</option>
<option value="ace/theme/dreamweaver">Dreamweaver</option>
<option value="ace/theme/eclipse">Eclipse</option>
<option value="ace/theme/github">GitHub</option>
<option value="ace/theme/idle_fingers">idleFingers</option>
<option value="ace/theme/kr_theme">krTheme</option>
<option value="ace/theme/merbivore">Merbivore</option>

View file

@ -72,22 +72,22 @@ exports.commands = [{
readOnly: true
}, {
name: "fold",
bindKey: bindKey("Alt-L", "Alt-L"),
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
exec: function(editor) { editor.session.toggleFold(false); },
readOnly: true
}, {
name: "unfold",
bindKey: bindKey("Alt-Shift-L", "Alt-Shift-L"),
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
exec: function(editor) { editor.session.toggleFold(true); },
readOnly: true
}, {
name: "foldall",
bindKey: bindKey("Alt-0", "Alt-0"),
bindKey: bindKey("Alt-0", "Command-Option-0"),
exec: function(editor) { editor.session.foldAll(); },
readOnly: true
}, {
name: "unfoldall",
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
exec: function(editor) { editor.session.unfold(); },
readOnly: true
}, {
@ -110,17 +110,17 @@ exports.commands = [{
readOnly: true
}, {
name: "overwrite",
bindKey: bindKey("Insert", "Insert"),
bindKey: "Insert",
exec: function(editor) { editor.toggleOverwrite(); },
readOnly: true
}, {
name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
readOnly: true
}, {
name: "gotostart",
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
readOnly: true
}, {
@ -137,13 +137,13 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttoend",
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotoend",
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
@ -233,43 +233,53 @@ exports.commands = [{
readOnly: true
}, {
name: "selectpagedown",
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
bindKey: "Shift-PageDown",
exec: function(editor) { editor.selectPageDown(); },
readOnly: true
}, {
name: "pagedown",
bindKey: bindKey(null, "PageDown"),
bindKey: bindKey(null, "Option-PageDown"),
exec: function(editor) { editor.scrollPageDown(); },
readOnly: true
}, {
name: "gotopagedown",
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
exec: function(editor) { editor.gotoPageDown(); },
readOnly: true
}, {
name: "selectpageup",
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
bindKey: "Shift-PageUp",
exec: function(editor) { editor.selectPageUp(); },
readOnly: true
}, {
name: "pageup",
bindKey: bindKey(null, "PageUp"),
bindKey: bindKey(null, "Option-PageUp"),
exec: function(editor) { editor.scrollPageUp(); },
readOnly: true
}, {
name: "gotopageup",
bindKey: bindKey("PageUp", "Option-PageUp"),
bindKey: "PageUp",
exec: function(editor) { editor.gotoPageUp(); },
readOnly: true
}, {
name: "scrollup",
bindKey: bindKey("Ctrl-Up", null),
exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "scrolldown",
bindKey: bindKey("Ctrl-Down", null),
exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "selectlinestart",
bindKey: bindKey("Shift-Home", "Shift-Home"),
bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectlineend",
bindKey: bindKey("Shift-End", "Shift-End"),
bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
readOnly: true
@ -285,10 +295,15 @@ exports.commands = [{
readOnly: true
}, {
name: "jumptomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(true); },
readOnly: true
},
// commands disabled in readOnly mode
@ -309,6 +324,11 @@ exports.commands = [{
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); },
multiSelectAction: "forEach"
}, {
name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); },
multiSelectAction: "forEach"
}, {
name: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"),
@ -348,7 +368,7 @@ exports.commands = [{
exec: function(editor) { editor.redo(); }
}, {
name: "copylinesup",
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); }
}, {
name: "movelinesup",
@ -356,7 +376,7 @@ exports.commands = [{
exec: function(editor) { editor.moveLinesUp(); }
}, {
name: "copylinesdown",
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); }
}, {
name: "movelinesdown",

View file

@ -92,7 +92,7 @@ exports.multiSelectCommands = [{
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
readonly: true,
isAvailable: function(editor) {return editor.inMultiSelectMode}
isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
}];
var HashHandler = require("../keyboard/hash_handler").HashHandler;

View file

@ -8,6 +8,7 @@
.ace_scroller {
position: absolute;
overflow: hidden;
width : 100%;
}
.ace_content {
@ -50,9 +51,11 @@
.ace_gutter-cell.ace_info {
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_dark .ace_gutter-cell.ace_info {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
}
.ace_editor .ace_sb {
position: absolute;
@ -246,9 +249,11 @@
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat;
background-position: center 5px;
background-position: center 4px;
border-radius: 3px;
border: 1px solid transparent;
}
.ace_fold-widget.end {
@ -262,11 +267,8 @@
.ace_fold-widget:hover {
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.2);
-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
background-position: center 4px;
}
@ -274,14 +276,34 @@
.ace_fold-widget:active {
border: 1px solid rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.05);
-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255);
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
box-shadow:inset 0 1px 1px rgba(255, 255, 255);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
/**
* Dark version for fold widgets
*/
.ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.1);
}
.ace_dark .ace_fold-widget:active {
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}
.ace_fold-widget.invalid {
background-color: #FFB4B4;
border-color: #DE5555;

View file

@ -827,7 +827,8 @@ var EditSession = function(text, mode) {
try {
module = require(mode);
} catch (e) {};
if (module)
// sometimes require returns empty object (this bug is present in requirejs 2 as well)
if (module && module.Mode)
return done(module);
// set mode to text until loading is finished

View file

@ -40,6 +40,7 @@ define(function(require, exports, module) {
"use strict";
var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range;
/**
* class BracketMatch
@ -76,15 +77,56 @@ function BracketMatch() {
if (charBeforeCursor == "") return null;
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
if (!match)
return null;
if (match[1])
return this.$findClosingBracket(match[1], position);
else
return this.$findOpeningBracket(match[2], position);
};
this.getBracketRange = function(pos) {
var line = this.getLine(pos.row);
var before = true, range;
var chr = line.charAt(pos.column-1);
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
pos.column++;
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
before = false;
}
if (!match)
return null;
if (match[1]) {
return this.$findClosingBracket(match[1], position);
var bracketPos = this.$findClosingBracket(match[1], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(pos, bracketPos);
if (!before) {
range.end.column++;
range.start.column--;
}
range.cursor = range.end;
} else {
return this.$findOpeningBracket(match[2], position);
var bracketPos = this.$findOpeningBracket(match[2], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(bracketPos, pos);
if (!before) {
range.start.column++;
range.end.column--;
}
range.cursor = range.start;
}
if (!before)
pos.column--;
return range;
};
this.$brackets = {

View file

@ -1348,6 +1348,24 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
this.duplicateSelection = function() {
var sel = this.selection;
var doc = this.session;
var range = sel.getRange();
if (range.isEmpty()) {
var row = range.start.row;
doc.duplicateLines(row, row);
} else {
var reverse = sel.isBackwards()
var point = sel.isBackwards() ? range.start : range.end;
var endPoint = doc.insert(point, doc.getTextRange(range), false);
range.start = point;
range.end = endPoint;
sel.setSelectionRange(range, reverse)
}
};
/** related to: EditSession.moveLinesDown
* Editor.moveLinesDown() -> Number
* + (Number): On success, it returns -1.
@ -1660,8 +1678,11 @@ var Editor = function(renderer, session) {
**/
this.centerSelection = function() {
var range = this.getSelectionRange();
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
this.renderer.scrollToLine(line, true);
var pos = {
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
}
this.renderer.alignCursor(pos, 0.5);
};
/** related to: Selection.getCursor
@ -1746,21 +1767,34 @@ var Editor = function(renderer, session) {
* Moves the cursor's row and column to the next matching bracket.
*
**/
this.jumpToMatching = function() {
this.jumpToMatching = function(select) {
var cursor = this.getCursorPosition();
var pos = this.session.findMatchingBracket(cursor);
if (!pos) {
cursor.column += 1;
pos = this.session.findMatchingBracket(cursor);
}
if (!pos) {
cursor.column -= 2;
pos = this.session.findMatchingBracket(cursor);
}
var range = this.session.getBracketRange(cursor);
if (!range) {
range = editor.find({
needle: /[{}()\[\]]/g,
preventScroll:true,
start: {row: cursor.row, column: cursor.column - 1}
});
if (!range)
return;
var pos = range.start;
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
range = this.session.getBracketRange(pos);
}
pos = range && range.cursor || pos;
if (pos) {
this.clearSelection();
this.moveCursorTo(pos.row, pos.column);
if (select) {
if (range && range.isEqual(editor.getSelectionRange()))
this.clearSelection();
else
this.selection.selectTo(pos.row, pos.column);
} else {
this.clearSelection();
this.moveCursorTo(pos.row, pos.column);
}
}
};

View file

@ -52,7 +52,7 @@ var baseStyles = require("../requirejs/text!./static.css");
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme, lineStart) {
exports.render = function(input, mode, theme, lineStart, disableGutter) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
@ -74,7 +74,8 @@ exports.render = function(input, mode, theme, lineStart) {
for(var ix = 0; ix < length; ix++) {
var lineTokens = session.getTokens(ix);
stringBuilder.push("<div class='ace_line'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
if (!disableGutter)
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
stringBuilder.push("</div>");
}

View file

@ -246,7 +246,6 @@ var TextInput = function(parentNode, host) {
});
this.focus = function() {
host.onFocus();
reset();
text.focus();
};
@ -281,10 +280,12 @@ var TextInput = function(parentNode, host) {
if (host.renderer.$keepTextAreaAtCursor)
host.renderer.$keepTextAreaAtCursor = null;
event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px";
}, onContextMenuClose);
// on windows context menu is opened after mouseup
if (useragent.isGecko && useragent.isWin)
event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px";
}, onContextMenuClose);
};
function onContextMenuClose() {

View file

@ -300,27 +300,27 @@ module.exports = {
case "(":
case "{":
case "[":
var cursor = editor.getCursorPosition()
var end = editor.session.$findClosingBracket(param, cursor, /paren/)
var cursor = editor.getCursorPosition();
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
if (!end)
return;
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/)
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
if (!start)
return;
start.column ++;
editor.selection.setSelectionRange(Range.fromPoints(start, end))
break
editor.selection.setSelectionRange(Range.fromPoints(start, end));
break;
case "'":
case "\"":
case '"':
case "/":
var end = find(editor, param, 1)
var end = find(editor, param, 1);
if (!end)
return;
var start = find(editor, param, -1)
var start = find(editor, param, -1);
if (!start)
return;
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start))
break
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
break;
}
}
},

View file

@ -93,7 +93,7 @@ exports.preventDefault = function(e) {
exports.getButton = function(e) {
if (e.type == "dblclick")
return 0;
else if (e.type == "contextmenu")
if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
return 2;
// DOM Event

View file

@ -48,7 +48,7 @@ var C9SearchHighlightRules = function() {
this.$rules = {
"start" : [
{
token : ["constant.numeric", "text", "text"],
token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"],
regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
},
{

View file

@ -19,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Garen J. Torikian <gjtorikian AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or

View file

@ -191,6 +191,22 @@ var JavaScriptHighlightRules = function() {
],
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // match stuff like: Sound.play = function play() { }
token : [
"storage.type",
"punctuation.operator",
"entity.name.function",
"text",
"keyword.operator",
"text",
"storage.type",
"text",
"entity.name.function",
"text",
"paren.lparen"
],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
next: "function_arguments"
}, { // match regular function like: function myFunc(arg) { }
token : [
"storage.type",

53
lib/ace/mode/jsx.js Normal file
View file

@ -0,0 +1,53 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
function Mode() {
this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
}
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
var match = line.match(/^.*[\{\(\[]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,122 @@
define(function(require, exports, module) {
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JsxHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
"if|throw|" +
"delete|in|try|" +
"class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
"number|int|string|boolean|variant|" +
"log|assert").split("|")
);
var buildinConstants = lang.arrayToMap(
("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
);
var reserved = lang.arrayToMap(
("debugger|with|" +
"const|export|" +
"let|private|public|yield|protected|" +
"extern|native|as|operator|__fake__|__readonly__").split("|")
);
var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
this.$rules = {
"start" : [
{
token : "comment",
regex : "\\/\\/.*$"
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
merge : true,
next : "comment"
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : [
"storage.type",
"text",
"entity.name.function"
],
regex : "(function)(\\s+)(" + identifierRe + ")"
}, {
token : function(value) {
if (value == "this")
return "variable.language";
else if (value == "function")
return "storage.type";
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
return "language.support.class";
else
return "identifier";
},
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : identifierRe
}, {
token : "keyword.operator",
regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, {
token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\;|\\."
}, {
token : "paren.lparen",
regex : "[[({<]"
}, {
token : "paren.rparen",
regex : "[\\])}>]"
}, {
token : "text",
regex : "\\s+"
}
],
"comment" : [
{
token : "comment", // closing comment
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(JsxHighlightRules, TextHighlightRules);
exports.JsxHighlightRules = JsxHighlightRules;
});

22
lib/ace/mode/luapage.js Normal file
View file

@ -0,0 +1,22 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlMode = require("./html").Mode;
var LuaMode = require("./lua").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules;
var Mode = function() {
var highlighter = new LuaPageHighlightRules();
this.$tokenizer = new Tokenizer(new LuaPageHighlightRules().getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({
"lua-": LuaMode
});
};
oop.inherits(Mode, HtmlMode);
exports.Mode = Mode;
});

View file

@ -0,0 +1,42 @@
// LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua
// documentation: http://keplerproject.github.com/cgilua/manual.html#templates
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
var LuaPageHighlightRules = function() {
this.$rules = new HtmlHighlightRules().getRules();
for (var i in this.$rules) {
this.$rules[i].unshift({
token: "keyword",
regex: "<\\%\\=?",
next: "lua-start"
}, {
token: "keyword",
regex: "<\\?lua\\=?",
next: "lua-start"
});
}
this.embedRules(LuaHighlightRules, "lua-", [
{
token: "keyword",
regex: "\\%>",
next: "start"
},
{
token: "keyword",
regex: "\\?>",
next: "start"
}
]);
};
oop.inherits(LuaPageHighlightRules, HtmlHighlightRules);
exports.LuaPageHighlightRules = LuaPageHighlightRules;
});

View file

@ -80,7 +80,7 @@ var MarkdownHighlightRules = function() {
return "markup.heading." + value.length;
},
regex : "^#{1,6}"
}, github_embed("javascript", "js-"),
}, github_embed("(?:javascript|js)", "js-"),
github_embed("xml", "xml-"),
github_embed("html", "html-"),
github_embed("css", "css-"),

View file

@ -90,7 +90,7 @@ function DefaultHandlers(mouseHandler) {
// 2: contextmenu, 1: linux paste
editor.textInput.onContextMenu(ev.domEvent);
return ev.stop();
return; // stopping event here breaks contextmenu on ff mac
}
// if this click caused the editor to be focused should not clear the
@ -109,13 +109,8 @@ function DefaultHandlers(mouseHandler) {
// a selection.
this.startSelect(pos);
} else if (inSelection) {
var e = ev.domEvent;
if ((e.ctrlKey || e.altKey)) {
this.startDrag();
} else {
this.mousedownEvent.time = (new Date()).getTime();
this.setState("dragWait");
}
this.mousedownEvent.time = (new Date()).getTime();
this.setState("dragWait");
}
this.captureMouse(ev);
@ -146,8 +141,9 @@ function DefaultHandlers(mouseHandler) {
} else if (cmp == 1) {
anchor = this.$clickSelection.start;
} else {
cursor = this.$clickSelection.end;
anchor = this.$clickSelection.start;
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
@ -175,8 +171,9 @@ function DefaultHandlers(mouseHandler) {
cursor = range.end;
anchor = range.start;
} else {
cursor = this.$clickSelection.end;
anchor = this.$clickSelection.start;
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
@ -221,7 +218,7 @@ function DefaultHandlers(mouseHandler) {
this.startSelect();
};
this.dragWait = function() {
this.dragWait = function(e) {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
var time = (new Date()).getTime();
var editor = this.editor;
@ -229,7 +226,7 @@ function DefaultHandlers(mouseHandler) {
if (distance > DRAG_OFFSET) {
this.startSelect();
} else if (time - this.mousedownEvent.time > editor.getDragDelay()) {
this.startDrag()
this.startDrag();
}
};
@ -277,12 +274,21 @@ function DefaultHandlers(mouseHandler) {
this.onDoubleClick = function(ev) {
var pos = ev.getDocumentPosition();
var editor = this.editor;
var session = editor.session
var range = session.getBracketRange(pos);
if (range) {
if (range.isEmpty()) {
range.start.column--;
range.end.column++;
}
this.$clickSelection = range;
this.setState("select");
return;
}
this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column);
this.setState("selectByWords");
editor.moveCursorToPosition(pos);
editor.selection.selectWord();
this.$clickSelection = editor.getSelectionRange();
};
this.onTripleClick = function(ev) {
@ -334,4 +340,16 @@ function calcDistance(ax, ay, bx, by) {
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
}
function calcRangeOrientation(range, cursor) {
if (range.start.row == range.end.row)
var cmp = 2 * cursor.column - range.start.column - range.end.column;
else
var cmp = 2 * cursor.row - range.start.row - range.end.row;
if (cmp < 0)
return {cursor: range.start, anchor: range.end};
else
return {cursor: range.end, anchor: range.start};
}
});

View file

@ -40,6 +40,7 @@ define(function(require, exports, module) {
"use strict";
var event = require("../lib/event");
var useragent = require("../lib/useragent");
/*
* Custom Ace mouse event
@ -130,9 +131,9 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
return this.domEvent.shiftKey;
};
this.getAccelKey = function() {
return this.domEvent.ctrlKey || this.domEvent.metaKey ;
};
this.getAccelKey = useragent.isMac
? function() { return this.domEvent.metaKey; }
: function() { return this.domEvent.ctrlKey; };
}).call(MouseEvent.prototype);

View file

@ -130,12 +130,12 @@ var MouseHandler = function(editor) {
renderer.$keepTextAreaAtCursor = null;
var self = this;
var onMouseSelection = function(e) {
var onMouseMove = function(e) {
self.x = e.clientX;
self.y = e.clientY;
};
var onMouseSelectionEnd = function(e) {
var onCaptureEnd = function(e) {
clearInterval(timerId);
self[self.state + "End"] && self[self.state + "End"](e);
self.$clickSelection = null;
@ -145,12 +145,12 @@ var MouseHandler = function(editor) {
}
};
var onSelectionInterval = function() {
var onCaptureInterval = function() {
self[self.state] && self[self.state]();
}
event.capture(this.editor.container, onMouseSelection, onMouseSelectionEnd);
var timerId = setInterval(onSelectionInterval, 20);
event.capture(this.editor.container, onMouseMove, onCaptureEnd);
var timerId = setInterval(onCaptureInterval, 20);
};
}).call(MouseHandler.prototype);

View file

@ -53,18 +53,14 @@ function onMouseDown(e) {
var ctrl = e.getAccelKey();
var button = e.getButton();
if (e.editor.inMultiSelectMode && button == 2) {
e.editor.textInput.onContextMenu(e.domEvent);
return;
}
if (!ctrl && !alt) {
if (e.editor.inMultiSelectMode) {
if (button == 0) {
e.editor.exitMultiSelectMode();
} else if (button == 2) {
var editor = e.editor;
var selectionEmpty = editor.selection.isEmpty();
editor.textInput.onContextMenu({x: e.clientX, y: e.clientY}, selectionEmpty);
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
e.stop();
}
}
if (button == 0 && e.editor.inMultiSelectMode)
e.editor.exitMultiSelectMode();
return;
}

View file

@ -90,7 +90,6 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
* [start.row/start.column] -> [end.row/end.column]
*
**/
this.toString = function() {
return ("Range: [" + this.start.row + "/" + this.start.column +
"] -> [" + this.end.row + "/" + this.end.column + "]");
@ -424,7 +423,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
/**
/**
* Range.compareInside(row, column) -> Number
* - row (Number): A row point to compare with
* - column (Number): A column point to compare with
@ -449,7 +448,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
/**
/**
* Range.clipRows(firstRow, lastRow) -> Range
* - firstRow (Number): The starting row
* - lastRow (Number): The ending row
@ -488,7 +487,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(start || this.start, end || this.end);
};
/**
/**
* Range.extend(row, column) -> Range
* - row (Number): A new row to extend to
* - column (Number): A new column to extend to
@ -513,7 +512,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return (this.start.row == this.end.row && this.start.column == this.end.column);
};
/**
/**
* Range.isMultiLine() -> Boolean
*
* Returns true if the range spans across multiple lines.
@ -523,7 +522,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return (this.start.row !== this.end.row);
};
/**
/**
* Range.clone() -> Range
*
* Returns a duplicate of the calling range.
@ -533,7 +532,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(this.start, this.end);
};
/**
/**
* Range.collapseRows() -> Range
*
* Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
@ -546,7 +545,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return new Range(this.start.row, 0, this.end.row, 0)
};
/**
/**
* Range.toScreenRange(session) -> Range
* - session (EditSession): The `EditSession` to retrieve coordinates from
*

View file

@ -18,7 +18,6 @@
}
.ace-chrome .ace_text-layer {
cursor: text;
}
.ace-chrome .ace_cursor {
@ -151,7 +150,10 @@ color:#FD971F;
color: rgb(255, 0, 0)
}
.ace-chrome .ace_line .ace_string,
.ace-chrome .ace_line .ace_string{
color: #1A1AA6;
}
.ace-chrome .ace_entity.ace_other.ace_attribute-name{
color: #994409;
}

View file

@ -22,7 +22,6 @@
}
.ace-clouds .ace_text-layer {
cursor: text;
color: #000000;
}

View file

@ -22,7 +22,6 @@
}
.ace-clouds-midnight .ace_text-layer {
cursor: text;
color: #929292;
}

View file

@ -22,7 +22,6 @@
}
.ace-cobalt .ace_text-layer {
cursor: text;
color: #FFFFFF;
}

View file

@ -23,7 +23,6 @@
}
.ace-crimson-editor .ace_text-layer {
cursor: text;
color: rgb(64, 64, 64);
}

View file

@ -22,7 +22,6 @@
}
.ace-dawn .ace_text-layer {
cursor: text;
color: #080808;
}

View file

@ -21,7 +21,6 @@
}
.ace-dreamweaver .ace_text-layer {
cursor: text;
}
.ace-dreamweaver .ace_cursor {

View file

@ -22,7 +22,6 @@
}
.ace-eclipse .ace_text-layer {
cursor: text;
}
.ace-eclipse .ace_cursor {

81
lib/ace/theme/github.css Normal file
View file

@ -0,0 +1,81 @@
/* CSS style content from github's default pygments highlighter template.
Cursor and selection styles from textmate.css. */
.ace-github .ace_editor {
color: #333;
background-color: #F8F8F8;
border: 1px solid #CCC;
font: 13px 'Bitstream Vera Sans Mono', Courier, monospace !important;
line-height: 19px !important;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
position: relative;
margin-bottom: 15px;
}
.ace-github .ace_keyword {
font-weight: bold;
}
.ace-github .ace_string {
color: #D14;
}
.ace-github .ace_variable.ace_class {
color: teal;
}
.ace-github .ace_constant.ace_numeric {
color: #099;
}
.ace-github .ace_comment {
color: #998;
font-style: italic;
}
.ace-github .ace_variable.ace_language {
color: #0086B3;
}
.ace-github .ace_paren.ace_lparen,
.ace-github .ace_paren.ace_rparen {
font-weight: bold;
}
.ace-github .ace_constant.ace_language.ace_boolean {
font-weight: bold;
}
.ace-github .ace_string.ace_regexp {
color: #009926;
font-weight: normal;
}
.ace-github .ace_variable.ace_instancce {
color: teal;
}
.ace-github .ace_constant.ace_language {
font-weight: bold;
}
.ace-github .ace_text-layer {
}
.ace-github .ace_cursor {
border-left: 2px solid black;
}
.ace-github .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid black;
}
.ace-github .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-github.multiselect .ace_selection.start {
box-shadow: 0 0 3px 0px white;
border-radius: 2px;
}

46
lib/ace/theme/github.js Normal file
View file

@ -0,0 +1,46 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-github";
exports.cssText = require('ace/requirejs/text!./github.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});

View file

@ -22,7 +22,6 @@
}
.ace-idle-fingers .ace_text-layer {
cursor: text;
color: #FFFFFF;
}

View file

@ -22,7 +22,6 @@
}
.ace-kr-theme .ace_text-layer {
cursor: text;
color: #FCFFE0;
}

View file

@ -22,7 +22,6 @@
}
.ace-merbivore .ace_text-layer {
cursor: text;
color: #E6E1DC;
}

View file

@ -22,7 +22,6 @@
}
.ace-merbivore-soft .ace_text-layer {
cursor: text;
color: #E6E1DC;
}

View file

@ -22,7 +22,6 @@
}
.ace-mono-industrial .ace_text-layer {
cursor: text;
color: #FFFFFF;
}

View file

@ -22,7 +22,6 @@
}
.ace-monokai .ace_text-layer {
cursor: text;
color: #F8F8F2;
}

View file

@ -22,7 +22,6 @@
}
.ace-pastel-on-dark .ace_text-layer {
cursor: text;
color: #8F938F;
}

View file

@ -22,7 +22,6 @@
}
.ace-solarized-dark .ace_text-layer {
cursor: text;
color: #93A1A1;
}

View file

@ -22,7 +22,6 @@
}
.ace-solarized-light .ace_text-layer {
cursor: text;
color: #586E75;
}

View file

@ -21,7 +21,6 @@
}
.ace-tm .ace_text-layer {
cursor: text;
}
.ace-tm .ace_cursor {

View file

@ -22,7 +22,6 @@
}
.ace-tomorrow .ace_text-layer {
cursor: text;
color: #4D4D4C;
}

View file

@ -22,7 +22,6 @@
}
.ace-tomorrow-night .ace_text-layer {
cursor: text;
color: #C5C8C6;
}

View file

@ -22,7 +22,6 @@
}
.ace-tomorrow-night-blue .ace_text-layer {
cursor: text;
color: #FFFFFF;
}

View file

@ -22,7 +22,6 @@
}
.ace-tomorrow-night-bright .ace_text-layer {
cursor: text;
color: #DEDEDE;
}

View file

@ -22,7 +22,6 @@
}
.ace-tomorrow-night-eighties .ace_text-layer {
cursor: text;
color: #CCCCCC;
}

View file

@ -22,7 +22,6 @@
}
.ace-twilight .ace_text-layer {
cursor: text;
color: #F8F8F8;
}

View file

@ -22,7 +22,6 @@
}
.ace-vibrant-ink .ace_text-layer {
cursor: text;
color: #FFFFFF;
}

View file

@ -263,8 +263,13 @@ var VirtualRenderer = function(container, theme) {
*
* Triggers a full update of all the layers, for all the rows.
**/
this.updateFull = function() {
this.$loop.schedule(this.CHANGE_FULL);
this.updateFull = function(force) {
if (force){
this.$renderChanges(this.CHANGE_FULL, true);
}
else {
this.$loop.schedule(this.CHANGE_FULL);
}
};
/**
@ -282,11 +287,19 @@ var VirtualRenderer = function(container, theme) {
*
* [Triggers a resize of the editor.]{: #VirtualRenderer.onResize}
**/
this.onResize = function(force) {
this.onResize = function(force, gutterWidth, width, height) {
var changes = this.CHANGE_SIZE;
var size = this.$size;
var height = dom.getInnerHeight(this.container);
if (this.resizing > 2)
return;
else if (this.resizing > 1)
this.resizing++;
else
this.resizing = force ? 1 : 0;
if (!height)
height = dom.getInnerHeight(this.container);
if (force || size.height != height) {
size.height = height;
@ -300,20 +313,27 @@ var VirtualRenderer = function(container, theme) {
}
}
var width = dom.getInnerWidth(this.container);
if (force || size.width != width) {
if (!width)
width = dom.getInnerWidth(this.container);
if (force || this.resizing > 1 || size.width != width) {
size.width = width;
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
this.scroller.style.left = gutterWidth + "px";
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
this.scroller.style.width = size.scrollerWidth + "px";
//this.scroller.style.width = size.scrollerWidth + "px";
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
changes = changes | this.CHANGE_FULL;
}
this.$loop.schedule(changes);
if (force)
this.$renderChanges(changes, true);
else
this.$loop.schedule(changes);
if (force)
delete this.resizing;
};
/**
@ -467,14 +487,14 @@ var VirtualRenderer = function(container, theme) {
return;
if (!gutterReady) {
var ch = this.$gutterLayer.element.children
var oldEl = ch[this.$gutterLineHighlight - this.layerConfig.firstRow];
if (oldEl)
dom.removeCssClass(oldEl, "ace_gutter_active_line");
var lineEl, ch = this.$gutterLayer.element.children;
var index = this.$gutterLineHighlight - this.layerConfig.firstRow;
if (index >= 0 && (lineEl = ch[index]))
dom.removeCssClass(lineEl, "ace_gutter_active_line");
var newEl = ch[i - this.layerConfig.firstRow];
if (newEl)
dom.addCssClass(newEl, "ace_gutter_active_line");
index = i - this.layerConfig.firstRow;
if (index >= 0 && (lineEl = ch[index]))
dom.addCssClass(lineEl, "ace_gutter_active_line");
}
this.$gutterLayer.removeGutterDecoration(this.$gutterLineHighlight, "ace_gutter_active_line");
@ -642,8 +662,8 @@ var VirtualRenderer = function(container, theme) {
this.scrollBar.setScrollTop(this.scrollTop);
};
this.$renderChanges = function(changes) {
if (!changes || !this.session || !this.container.offsetWidth)
this.$renderChanges = function(changes, force) {
if (!force && (!changes || !this.session || !this.container.offsetWidth))
return;
// text, scrolling and resize changes can cause the view port size to change

View file

@ -56,14 +56,17 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
workerUrl = require.nameToUrl("ace/worker/worker_sourcemint");
} else {
// We are running in RequireJS.
workerUrl = this.$normalizePath(require.nameToUrl("ace/worker/worker", null, "_"));
// nameToUrl is renamed to toUrl in requirejs 2
if (require.nameToUrl && !require.toUrl)
require.toUrl = require.nameToUrl;
workerUrl = this.$normalizePath(require.toUrl("ace/worker/worker", null, "_"));
}
this.$worker = new Worker(workerUrl);
var tlns = {};
for (var i=0; i<topLevelNamespaces.length; i++) {
var ns = topLevelNamespaces[i];
var path = this.$normalizePath(require.nameToUrl(ns, null, "_").replace(/.js$/, ""));
var path = this.$normalizePath(require.toUrl(ns, null, "_").replace(/.js$/, ""));
tlns[ns] = path;
}

View file

@ -11,9 +11,7 @@
"url" : "http://github.com/ajaxorg/ace.git"
},
"dependencies": {
"mime": "1.2.x"
},
"devDependencies": {
"mime": "1.2.x",
"asyncjs": "0.0.x",
"jsdom": "0.2.x",
"amd-loader": "~0.0.4",

View file

@ -22,7 +22,6 @@
}
.%cssClass% .ace_text-layer {
cursor: text;
color: %foreground%;
}