Merge branch 'master' of https://github.com/ajaxorg/ace into cvox
This commit is contained in:
commit
23f62e015b
10 changed files with 2401 additions and 2109 deletions
|
|
@ -243,7 +243,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="sideToggler">
|
||||
<div id="ellipsis_Document.getAllLines" class="ellipsis_description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>
|
||||
<div id="ellipsis_Document.getAllLines" class="ellipsis_description"><p>Returns all lines in the document as string array.</p>
|
||||
|
||||
</div>
|
||||
<div class="description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>
|
||||
|
|
|
|||
2
build
2
build
|
|
@ -1 +1 @@
|
|||
Subproject commit cf536740d866276b65cfd351610001c2a841e751
|
||||
Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253
|
||||
|
|
@ -177,6 +177,26 @@ env.editor.commands.addCommands([{
|
|||
editor.showKeyboardShortcuts()
|
||||
})
|
||||
}
|
||||
}, {
|
||||
name: "increaseFontSize",
|
||||
bindKey: "Ctrl-+",
|
||||
exec: function(editor) {
|
||||
var size = parseInt(editor.getFontSize(), 10) || 12;
|
||||
editor.setFontSize(size + 1);
|
||||
}
|
||||
}, {
|
||||
name: "decreaseFontSize",
|
||||
bindKey: "Ctrl+-",
|
||||
exec: function(editor) {
|
||||
var size = parseInt(editor.getFontSize(), 10) || 12;
|
||||
editor.setFontSize(Math.max(size - 1 || 1));
|
||||
}
|
||||
}, {
|
||||
name: "resetFontSize",
|
||||
bindKey: "Ctrl+0",
|
||||
exec: function(editor) {
|
||||
editor.setFontSize(12);
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
|
|
@ -199,7 +219,31 @@ var commands = env.editor.commands;
|
|||
commands.addCommand({
|
||||
name: "save",
|
||||
bindKey: {win: "Ctrl-S", mac: "Command-S"},
|
||||
exec: function() {alert("Fake Save File");}
|
||||
exec: function(arg) {
|
||||
var session = env.editor.session;
|
||||
name = session.name.match(/[^\/]+$/)
|
||||
localStorage.setItem(
|
||||
"saved_file:" + name,
|
||||
session.getValue()
|
||||
);
|
||||
env.editor.cmdLine.setValue("saved "+ name);
|
||||
}
|
||||
});
|
||||
|
||||
commands.addCommand({
|
||||
name: "load",
|
||||
bindKey: {win: "Ctrl-O", mac: "Command-O"},
|
||||
exec: function(arg) {
|
||||
var session = env.editor.session;
|
||||
name = session.name.match(/[^\/]+$/)
|
||||
var value = localStorage.getItem("saved_file:" + name);
|
||||
if (typeof value == "string") {
|
||||
session.setValue(value);
|
||||
env.editor.cmdLine.setValue("loaded "+ name);
|
||||
} else {
|
||||
env.editor.cmdLine.setValue("no previuos value saved for "+ name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var keybindings = {
|
||||
|
|
@ -247,6 +291,7 @@ var showGutterEl = document.getElementById("show_gutter");
|
|||
var showPrintMarginEl = document.getElementById("show_print_margin");
|
||||
var highlightSelectedWordE = document.getElementById("highlight_selected_word");
|
||||
var showHScrollEl = document.getElementById("show_hscroll");
|
||||
var showVScrollEl = document.getElementById("show_vscroll");
|
||||
var animateScrollEl = document.getElementById("animate_scroll");
|
||||
var softTabEl = document.getElementById("soft_tab");
|
||||
var behavioursEl = document.getElementById("enable_behaviours");
|
||||
|
|
@ -409,7 +454,11 @@ bindCheckbox("highlight_selected_word", function(checked) {
|
|||
});
|
||||
|
||||
bindCheckbox("show_hscroll", function(checked) {
|
||||
env.editor.renderer.setHScrollBarAlwaysVisible(checked);
|
||||
env.editor.setOption("hScrollBarAlwaysVisible", checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_vscroll", function(checked) {
|
||||
env.editor.setOption("vScrollBarAlwaysVisible", checked);
|
||||
});
|
||||
|
||||
bindCheckbox("animate_scroll", function(checked) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/** vim: et:ts=4:sw=4:sts=4
|
||||
* @license RequireJS 2.1.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* @license RequireJS 2.1.8+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
|
|
@ -12,7 +12,7 @@ var requirejs, require, define;
|
|||
(function (global) {
|
||||
var req, s, head, baseElement, dataMain, src,
|
||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||
version = '2.1.7',
|
||||
version = '2.1.8+',
|
||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||
jsSuffixRegExp = /\.js$/,
|
||||
|
|
@ -1609,7 +1609,7 @@ var requirejs, require, define;
|
|||
|
||||
//Join the path parts together, then figure out if baseUrl is needed.
|
||||
url = syms.join('/');
|
||||
url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
|
||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@
|
|||
<label for="show_hscroll">Persistent HScroll</label>
|
||||
</td><td>
|
||||
<input type="checkbox" name="show_hscroll" id="show_hscroll">
|
||||
<label for="show_hscroll">VScroll</label>
|
||||
<input type="checkbox" name="show_vscroll" id="show_vscroll">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Returns all the lines in the document as a single string, split by the new line character.
|
||||
* Returns all the lines in the document as a single string, joined by the new line character.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
return this.getAllLines().join(this.getNewLineCharacter());
|
||||
|
|
@ -191,7 +191,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
|
||||
* Returns all lines in the document as string array.
|
||||
**/
|
||||
this.getAllLines = function() {
|
||||
return this.getLines(0, this.getLength());
|
||||
|
|
|
|||
|
|
@ -2370,6 +2370,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
|||
wrapBehavioursEnabled: {initialValue: true},
|
||||
|
||||
hScrollBarAlwaysVisible: "renderer",
|
||||
vScrollBarAlwaysVisible: "renderer",
|
||||
highlightGutterLine: "renderer",
|
||||
animatedScroll: "renderer",
|
||||
showInvisibles: "renderer",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -738,9 +738,10 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$changes |= changes;
|
||||
return;
|
||||
}
|
||||
if (!this.$size.width)
|
||||
if (!this.$size.width) {
|
||||
this.$changes |= changes;
|
||||
return this.onResize(true);
|
||||
|
||||
}
|
||||
// this.$logChanges(changes);
|
||||
|
||||
this._signal("beforeRender");
|
||||
|
|
|
|||
|
|
@ -3,72 +3,165 @@ var https = require("https")
|
|||
, url = require("url")
|
||||
, fs = require("fs");
|
||||
|
||||
var Path = require("path");
|
||||
var spawn = require("child_process").spawn;
|
||||
var async = require("asyncjs");
|
||||
var rootDir = __dirname + "/../lib/ace/";
|
||||
|
||||
var deps = [{
|
||||
path: "mode/css/csslint.js",
|
||||
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
|
||||
needsFixup: true
|
||||
}, {
|
||||
path: "../../demo/kitchen-sink/require.js",
|
||||
url: "https://raw.github.com/jrburke/requirejs/master/require.js",
|
||||
needsFixup: false
|
||||
}, {
|
||||
path: "mode/lua/luaparse.js",
|
||||
url: "https://raw.github.com/oxyc/luaparse/master/luaparse.js",
|
||||
needsFixup: true,
|
||||
postProcess: function(src) {
|
||||
return src.replace(
|
||||
/\(function\s*\(root,\s*name,\s*factory\)\s*{[\s\S]*?}\(this,\s*'luaparse',/,
|
||||
"(function (root, name, factory) {\n factory(exports)\n}(this, 'luaparse',"
|
||||
)
|
||||
var deps = {
|
||||
csslint: {
|
||||
path: "mode/css/csslint.js",
|
||||
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
|
||||
needsFixup: true
|
||||
},
|
||||
requirejs: {
|
||||
path: "../../demo/kitchen-sink/require.js",
|
||||
url: "https://raw.github.com/jrburke/requirejs/master/require.js",
|
||||
needsFixup: false
|
||||
},
|
||||
luaparse: {
|
||||
path: "mode/lua/luaparse.js",
|
||||
url: "https://raw.github.com/oxyc/luaparse/master/luaparse.js",
|
||||
needsFixup: true,
|
||||
postProcess: function(src) {
|
||||
return src.replace(
|
||||
/\(function\s*\(root,\s*name,\s*factory\)\s*{[\s\S]*?}\(this,\s*'luaparse',/,
|
||||
"(function (root, name, factory) {\n factory(exports)\n}(this, 'luaparse',"
|
||||
)
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
path: "mode/javascript/jshint.js",
|
||||
url: "http://jshint.com/get/jshint-2.1.9.js",
|
||||
fetch: function(_, cb) {
|
||||
//run("npm install jshint@latest", function() {
|
||||
var base = Path.join(__dirname, "/node_modules/jshint/")
|
||||
var path = Path.join(base, "/src/stable/jshint")
|
||||
run('browserify ' + path + ' -i console-browserify -r jshint', function(err, src) {
|
||||
src = replaceConsoleBrowserify(src);
|
||||
var version = JSON.parse(fs.readFileSync(base + "package.json")).version
|
||||
src = [ "// " + version,
|
||||
"var JSHINT;",
|
||||
"(function () {",
|
||||
"require = null;",
|
||||
src,
|
||||
"JSHINT = require('jshint').JSHINT;",
|
||||
"}());"
|
||||
].join("\n")
|
||||
cb(err, src);
|
||||
})
|
||||
//});
|
||||
},
|
||||
needsFixup: true,
|
||||
postProcess: function(src) {
|
||||
src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2")
|
||||
.replace(/^(\},)(\{[^{}\[\]]*?\}\])/gm, "$1\n$2")
|
||||
|
||||
src = src.replace(
|
||||
/"Expected a conditional expression and instead saw an assignment."/g,
|
||||
'"Assignment in conditional expression"'
|
||||
);
|
||||
|
||||
src = src.replace(/\brequire\(["']|\(require,|\(require\)/g, function(r){
|
||||
return r.replace("require", "req");
|
||||
})
|
||||
|
||||
src = src.replace(/var defaultMaxListeners = 10;/, function(a) {return a.replace("10", "200")});
|
||||
|
||||
src = src.replace(/var JSHINT;\s*\(function[\s()]+\{\s*/, "")
|
||||
.replace(/JSHINT = .*\n\s*\}\(\)\);\s*/, "");
|
||||
src += '\n'
|
||||
+ 'function req() {return require.apply(this, arguments)}\n'
|
||||
+ 'module.exports = req("jshint");\n';
|
||||
return src;
|
||||
}
|
||||
},
|
||||
emmet: {
|
||||
path: "ext/emmet core.js",
|
||||
url: [
|
||||
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/emmet-app.js",
|
||||
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/snippets.json"
|
||||
],
|
||||
postProcess: function(data) {
|
||||
return data[0]
|
||||
.replace("define(emmet)", "define('emmet', [], emmet)")
|
||||
.replace(/(emmet.define\('bootstrap'.*)[\s\S]*$/, function(_, x) {
|
||||
return x + "\n" +
|
||||
"var snippets = " + data[1] + ";\n" +
|
||||
"var res = require('resources');\n" +
|
||||
"var userData = res.getVocabulary('user') || {};\n" +
|
||||
"res.setVocabulary(require('utils').deepMerge(userData, snippets), 'user');\n" +
|
||||
"});";
|
||||
});
|
||||
}
|
||||
},
|
||||
coffee: {
|
||||
fetch: function(){
|
||||
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
|
||||
var path = "mode/coffee/";
|
||||
|
||||
var subDir = "lib/coffee-script/";
|
||||
var deps = [
|
||||
"helpers.js",
|
||||
"lexer.js",
|
||||
"nodes.js",
|
||||
"parser.js",
|
||||
"rewriter.js",
|
||||
"scope.js"
|
||||
].map(function(x) {
|
||||
return {
|
||||
name: x,
|
||||
href: rootHref + subDir + x,
|
||||
path: rootDir + path + x
|
||||
};
|
||||
});
|
||||
deps.push({name:"LICENSE", href: rootHref + "LICENSE"});
|
||||
|
||||
var downloads = {}, counter = 0;
|
||||
|
||||
deps.forEach(function(x) {
|
||||
download(x.href, function(err, data) {
|
||||
counter++;
|
||||
downloads[x.name] = data;
|
||||
if (counter == deps.length)
|
||||
allDone();
|
||||
});
|
||||
});
|
||||
function allDone() {
|
||||
deps.pop();
|
||||
var license = downloads.LICENSE.split('\n');
|
||||
license = "/**\n * " + license.join("\n * ") + "\n */";
|
||||
|
||||
deps.forEach(function(x) {
|
||||
var data = downloads[x.name];
|
||||
console.log(x.name);
|
||||
console.log(!data);
|
||||
if (!data)
|
||||
return;
|
||||
if (x.name == "parser.js") {
|
||||
data = data.replace("var parser = (function(){", "")
|
||||
.replace(/\nreturn (new Parser)[\s\S]*$/, "\n\nmodule.exports = $1;\n\n");
|
||||
} else {
|
||||
data = data.replace("(function() {", "")
|
||||
.replace(/\}\).call\(this\);\s*$/, "");
|
||||
}
|
||||
data = license
|
||||
+ "\n\n"
|
||||
+ "define(function(require, exports, module) {\n"
|
||||
+ data
|
||||
+ "\n});";
|
||||
|
||||
fs.writeFile(x.path, data, "utf-8", function(err){
|
||||
if (err) throw err;
|
||||
console.log("File " + x.name + " saved.");
|
||||
console.warn("mode/coffee/coffee-script file needs to updated manually");
|
||||
console.warn("mode/coffee/parser.js: parseError function needs to be modified");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
path: "mode/javascript/jshint.js",
|
||||
url: "http://jshint.com/get/jshint-2.1.4.js",
|
||||
needsFixup: true,
|
||||
postProcess: function(src) {
|
||||
src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2")
|
||||
.replace(/^(\},)(\{[^{}\[\]]*?\}\])/gm, "$1\n$2")
|
||||
|
||||
src = src.replace(
|
||||
/"Expected a conditional expression and instead saw an assignment."/g,
|
||||
'"Assignment in conditional expression"'
|
||||
);
|
||||
|
||||
src = src.replace(/\brequire\(["']|\(require,|\(require\)/g, function(r){
|
||||
return r.replace("require", "req");
|
||||
})
|
||||
|
||||
src = src.replace(/var defaultMaxListeners = 10;/, function(a) {return a.replace("10", "200")});
|
||||
|
||||
src = src.replace(/var JSHINT;\s*\(function[\s()]+\{\s*/, "")
|
||||
.replace(/JSHINT = .*\n\s*\}\(\)\);\s*/, "");
|
||||
src += '\n'
|
||||
+ 'function req() {return require.apply(this, arguments)}\n'
|
||||
+ 'module.exports = req("jshint");\n';
|
||||
return src;
|
||||
}
|
||||
}, {
|
||||
path: "ext/emmet-core.js",
|
||||
url: [
|
||||
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/emmet-app.js",
|
||||
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/snippets.json"
|
||||
],
|
||||
postProcess: function(data) {
|
||||
return data[0]
|
||||
.replace("define(emmet)", "define('emmet', [], emmet)")
|
||||
.replace(/(emmet.define\('bootstrap'.*)[\s\S]*$/, function(_, x) {
|
||||
return x + "\n" +
|
||||
"var snippets = " + data[1] + ";\n" +
|
||||
"var res = require('resources');\n" +
|
||||
"var userData = res.getVocabulary('user') || {};\n" +
|
||||
"res.setVocabulary(require('utils').deepMerge(userData, snippets), 'user');\n" +
|
||||
"});";
|
||||
});
|
||||
}
|
||||
}];
|
||||
};
|
||||
|
||||
var download = function(href, callback) {
|
||||
if (Array.isArray(href))
|
||||
|
|
@ -92,7 +185,9 @@ var download = function(href, callback) {
|
|||
};
|
||||
|
||||
var getDep = function(dep) {
|
||||
download(dep.url, function(err, data) {
|
||||
if (!dep.fetch)
|
||||
dep.fetch = download
|
||||
dep.fetch(dep.url, function(err, data) {
|
||||
if (dep.postProcess)
|
||||
data = dep.postProcess(data);
|
||||
if (dep.needsFixup)
|
||||
|
|
@ -107,74 +202,59 @@ var getDep = function(dep) {
|
|||
});
|
||||
};
|
||||
|
||||
deps.slice(-1).forEach(getDep);
|
||||
function run(cmd, cb) {
|
||||
var proc = process.platform == "win32"
|
||||
? spawn("cmd", ["/c", cmd], {cwd: __dirname})
|
||||
: spawn("bash", ["-c", cmd], {cwd: __dirname});
|
||||
|
||||
// coffee-script
|
||||
void function(){
|
||||
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
|
||||
var path = "mode/coffee/";
|
||||
var result = "", err = "";
|
||||
proc.stderr.setEncoding("utf8");
|
||||
proc.stderr.on('data', function (data) {
|
||||
err += data;
|
||||
});
|
||||
|
||||
var subDir = "lib/coffee-script/";
|
||||
var deps = [
|
||||
"helpers.js",
|
||||
"lexer.js",
|
||||
"nodes.js",
|
||||
"parser.js",
|
||||
"rewriter.js",
|
||||
"scope.js"
|
||||
].map(function(x) {
|
||||
return {
|
||||
name: x,
|
||||
href: rootHref + subDir + x,
|
||||
path: rootDir + path + x
|
||||
};
|
||||
});
|
||||
deps.push({name:"LICENSE", href: rootHref + "LICENSE"});
|
||||
proc.stdout.setEncoding("utf8");
|
||||
proc.stdout.on('data', function (data) {
|
||||
result += data;
|
||||
});
|
||||
|
||||
var downloads = {}, counter = 0;
|
||||
|
||||
deps.forEach(function(x) {
|
||||
download(x.href, function(err, data) {
|
||||
counter++;
|
||||
downloads[x.name] = data;
|
||||
if (counter == deps.length)
|
||||
allDone();
|
||||
});
|
||||
});
|
||||
function allDone() {
|
||||
deps.pop();
|
||||
var license = downloads.LICENSE.split('\n');
|
||||
license = "/**\n * " + license.join("\n * ") + "\n */";
|
||||
|
||||
deps.forEach(function(x) {
|
||||
var data = downloads[x.name];
|
||||
console.log(x.name);
|
||||
console.log(!data);
|
||||
if (!data)
|
||||
return;
|
||||
if (x.name == "parser.js") {
|
||||
data = data.replace("var parser = (function(){", "")
|
||||
.replace(/\nreturn (new Parser)[\s\S]*$/, "\n\nmodule.exports = $1;\n\n");
|
||||
} else {
|
||||
data = data.replace("(function() {", "")
|
||||
.replace(/\}\).call\(this\);\s*$/, "");
|
||||
}
|
||||
data = license
|
||||
+ "\n\n"
|
||||
+ "define(function(require, exports, module) {\n"
|
||||
+ data
|
||||
+ "\n});";
|
||||
|
||||
fs.writeFile(x.path, data, "utf-8", function(err){
|
||||
if (err) throw err;
|
||||
console.log("File " + x.name + " saved.");
|
||||
console.warn("mode/coffee/coffee-script file needs to updated manually");
|
||||
console.warn("mode/coffee/parser.js: parseError function needs to be modified");
|
||||
});
|
||||
});
|
||||
proc.on('exit', done);
|
||||
proc.on('close', done);
|
||||
function done(code) {
|
||||
if (code !== 0) {
|
||||
console.error(cmd + '::: process exited with code :::' + code);
|
||||
console.error(err)
|
||||
}
|
||||
cb(err, result)
|
||||
}
|
||||
}//();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function unquote(str) {
|
||||
return str.replace(/\\(.)/g, function(x, a) {
|
||||
return a == "n" ? "\n"
|
||||
: a == "t" ? "\t"
|
||||
: a == "r" ? "\r"
|
||||
: a
|
||||
});
|
||||
}
|
||||
|
||||
function replaceConsoleBrowserify(str) {
|
||||
var simpleConsole = function(req,module,exports){
|
||||
["log", "info", "warn", "error",
|
||||
"time","timeEnd", "trace", "dir", "assert"
|
||||
].forEach(function(x) {exports[x] = nop;});
|
||||
function nop() {}
|
||||
}
|
||||
var m = /"console-browserify":(\d+)/.exec(str);
|
||||
name = m && m[1];
|
||||
if (name) {
|
||||
str = str.replace(
|
||||
"{1:[",
|
||||
"{" + name + ":[" + simpleConsole + ",{}],\n1:["
|
||||
)
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
getDep(deps.jshint)
|
||||
Loading…
Add table
Add a link
Reference in a new issue