Merge branch 'master' of https://github.com/ajaxorg/ace into cvox

This commit is contained in:
Peter Xiao 2013-08-14 15:27:01 -07:00
commit 23f62e015b
10 changed files with 2401 additions and 2109 deletions

View file

@ -243,7 +243,7 @@
</ul> </ul>
</div> </div>
<div class="sideToggler"> <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>
<div class="description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p> <div class="description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>

2
build

@ -1 +1 @@
Subproject commit cf536740d866276b65cfd351610001c2a841e751 Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253

View file

@ -177,6 +177,26 @@ env.editor.commands.addCommands([{
editor.showKeyboardShortcuts() 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({ commands.addCommand({
name: "save", name: "save",
bindKey: {win: "Ctrl-S", mac: "Command-S"}, 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 = { var keybindings = {
@ -247,6 +291,7 @@ var showGutterEl = document.getElementById("show_gutter");
var showPrintMarginEl = document.getElementById("show_print_margin"); var showPrintMarginEl = document.getElementById("show_print_margin");
var highlightSelectedWordE = document.getElementById("highlight_selected_word"); var highlightSelectedWordE = document.getElementById("highlight_selected_word");
var showHScrollEl = document.getElementById("show_hscroll"); var showHScrollEl = document.getElementById("show_hscroll");
var showVScrollEl = document.getElementById("show_vscroll");
var animateScrollEl = document.getElementById("animate_scroll"); var animateScrollEl = document.getElementById("animate_scroll");
var softTabEl = document.getElementById("soft_tab"); var softTabEl = document.getElementById("soft_tab");
var behavioursEl = document.getElementById("enable_behaviours"); var behavioursEl = document.getElementById("enable_behaviours");
@ -409,7 +454,11 @@ bindCheckbox("highlight_selected_word", function(checked) {
}); });
bindCheckbox("show_hscroll", 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) { bindCheckbox("animate_scroll", function(checked) {

View file

@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4 /** 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. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details * see: http://github.com/jrburke/requirejs for details
*/ */
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) { (function (global) {
var req, s, head, baseElement, dataMain, src, var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath, interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.7', version = '2.1.8+',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/, jsSuffixRegExp = /\.js$/,
@ -1609,7 +1609,7 @@ var requirejs, require, define;
//Join the path parts together, then figure out if baseUrl is needed. //Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/'); 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; url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
} }

View file

@ -188,6 +188,8 @@
<label for="show_hscroll">Persistent HScroll</label> <label for="show_hscroll">Persistent HScroll</label>
</td><td> </td><td>
<input type="checkbox" name="show_hscroll" id="show_hscroll"> <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> </td>
</tr> </tr>
<tr> <tr>

View file

@ -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() { this.getValue = function() {
return this.getAllLines().join(this.getNewLineCharacter()); 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() { this.getAllLines = function() {
return this.getLines(0, this.getLength()); return this.getLines(0, this.getLength());

View file

@ -2370,6 +2370,7 @@ config.defineOptions(Editor.prototype, "editor", {
wrapBehavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true},
hScrollBarAlwaysVisible: "renderer", hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer",
highlightGutterLine: "renderer", highlightGutterLine: "renderer",
animatedScroll: "renderer", animatedScroll: "renderer",
showInvisibles: "renderer", showInvisibles: "renderer",

File diff suppressed because it is too large Load diff

View file

@ -738,9 +738,10 @@ var VirtualRenderer = function(container, theme) {
this.$changes |= changes; this.$changes |= changes;
return; return;
} }
if (!this.$size.width) if (!this.$size.width) {
this.$changes |= changes;
return this.onResize(true); return this.onResize(true);
}
// this.$logChanges(changes); // this.$logChanges(changes);
this._signal("beforeRender"); this._signal("beforeRender");

View file

@ -3,18 +3,23 @@ var https = require("https")
, url = require("url") , url = require("url")
, fs = require("fs"); , fs = require("fs");
var Path = require("path");
var spawn = require("child_process").spawn;
var async = require("asyncjs"); var async = require("asyncjs");
var rootDir = __dirname + "/../lib/ace/"; var rootDir = __dirname + "/../lib/ace/";
var deps = [{ var deps = {
csslint: {
path: "mode/css/csslint.js", path: "mode/css/csslint.js",
url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js", url: "https://raw.github.com/stubbornella/csslint/master/release/csslint-node.js",
needsFixup: true needsFixup: true
}, { },
requirejs: {
path: "../../demo/kitchen-sink/require.js", path: "../../demo/kitchen-sink/require.js",
url: "https://raw.github.com/jrburke/requirejs/master/require.js", url: "https://raw.github.com/jrburke/requirejs/master/require.js",
needsFixup: false needsFixup: false
}, { },
luaparse: {
path: "mode/lua/luaparse.js", path: "mode/lua/luaparse.js",
url: "https://raw.github.com/oxyc/luaparse/master/luaparse.js", url: "https://raw.github.com/oxyc/luaparse/master/luaparse.js",
needsFixup: true, needsFixup: true,
@ -24,9 +29,29 @@ var deps = [{
"(function (root, name, factory) {\n factory(exports)\n}(this, 'luaparse'," "(function (root, name, factory) {\n factory(exports)\n}(this, 'luaparse',"
) )
} }
}, { },
jshint: {
path: "mode/javascript/jshint.js", path: "mode/javascript/jshint.js",
url: "http://jshint.com/get/jshint-2.1.4.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, needsFixup: true,
postProcess: function(src) { postProcess: function(src) {
src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2") src = src.replace(/(\],|\{)((?:\d+|"\w+"):\[)/g, "$1\n$2")
@ -50,8 +75,9 @@ var deps = [{
+ 'module.exports = req("jshint");\n'; + 'module.exports = req("jshint");\n';
return src; return src;
} }
}, { },
path: "ext/emmet-core.js", emmet: {
path: "ext/emmet core.js",
url: [ url: [
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/emmet-app.js", "https://raw.github.com/sergeche/emmet-sublime/master/emmet/emmet-app.js",
"https://raw.github.com/sergeche/emmet-sublime/master/emmet/snippets.json" "https://raw.github.com/sergeche/emmet-sublime/master/emmet/snippets.json"
@ -68,49 +94,9 @@ var deps = [{
"});"; "});";
}); });
} }
}]; },
coffee: {
var download = function(href, callback) { fetch: function(){
if (Array.isArray(href))
return async.map(href, download, callback);
var options = url.parse(href);
var protocol = options.protocol === "https:" ? https : http;
console.log("connecting to " + options.host + " " + options.path);
protocol.get(options, function(res) {
var data = "";
res.setEncoding("utf-8");
res.on("data", function(chunk){
data += chunk;
});
res.on("end", function(){
callback(null, data);
});
});
};
var getDep = function(dep) {
download(dep.url, function(err, data) {
if (dep.postProcess)
data = dep.postProcess(data);
if (dep.needsFixup)
data = "define(function(require, exports, module) {\n"
+ data
+ "\n});";
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
if (err) throw err;
console.log("File " + dep.path + " saved.");
});
});
};
deps.slice(-1).forEach(getDep);
// coffee-script
void function(){
var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/"; var rootHref = "https://raw.github.com/jashkenas/coffee-script/master/";
var path = "mode/coffee/"; var path = "mode/coffee/";
@ -173,8 +159,102 @@ void function(){
}); });
}); });
} }
}//(); }
}
};
var download = function(href, callback) {
if (Array.isArray(href))
return async.map(href, download, callback);
var options = url.parse(href);
var protocol = options.protocol === "https:" ? https : http;
console.log("connecting to " + options.host + " " + options.path);
protocol.get(options, function(res) {
var data = "";
res.setEncoding("utf-8");
res.on("data", function(chunk){
data += chunk;
});
res.on("end", function(){
callback(null, data);
});
});
};
var getDep = function(dep) {
if (!dep.fetch)
dep.fetch = download
dep.fetch(dep.url, function(err, data) {
if (dep.postProcess)
data = dep.postProcess(data);
if (dep.needsFixup)
data = "define(function(require, exports, module) {\n"
+ data
+ "\n});";
fs.writeFile(rootDir + dep.path, data, "utf-8", function(err){
if (err) throw err;
console.log("File " + dep.path + " saved.");
});
});
};
function run(cmd, cb) {
var proc = process.platform == "win32"
? spawn("cmd", ["/c", cmd], {cwd: __dirname})
: spawn("bash", ["-c", cmd], {cwd: __dirname});
var result = "", err = "";
proc.stderr.setEncoding("utf8");
proc.stderr.on('data', function (data) {
err += data;
});
proc.stdout.setEncoding("utf8");
proc.stdout.on('data', function (data) {
result += data;
});
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)