update ace to cd271f1a8bd33712f90dc91d0105bc6674e8c6a4

This commit is contained in:
Chris Wanstrath
2011-11-29 09:16:53 -08:00
parent 7fff476a62
commit b9fc94ef6c
10 changed files with 42 additions and 30 deletions

View File

@@ -254,15 +254,15 @@ exports.commands = [{
readOnly: true
}, {
name: "togglerecording",
bindKey: bindKey("Ctrl-Shift-E", "Ctrl-Shift-E"),
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
exec: function(editor) { editor.commands.toggleRecording(); },
readOnly: true
}, {
name: "replaymacro",
bindKey: bindKey("Ctrl-E", "Ctrl-Fuck-You"),
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
exec: function(editor) { editor.commands.replay(editor); },
readOnly: true
},
},
// commands disabled in readOnly mode
{

View File

@@ -1,4 +1,4 @@
/* @import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono); */
/*@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);*/
.ace_editor {

View File

@@ -39,7 +39,6 @@
define(function(require, exports, module) {
var useragent = require("../lib/useragent");
var keyUtil = require("../lib/keys");
var event = require("../lib/event");
require("../commands/default_commands");
@@ -76,8 +75,9 @@ var KeyBinding = function(editor) {
};
this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
var toExecute;
for (var i = this.$handlers.length; i--;) {
var toExecute = this.$handlers[i].handleKeyboard(
toExecute = this.$handlers[i].handleKeyboard(
this.$data, hashId, keyString, keyCode, e
);
if (toExecute && toExecute.command)
@@ -97,13 +97,13 @@ var KeyBinding = function(editor) {
if (success && e)
event.stopEvent(e);
return success
return success;
};
this.handleKeyboard = function(data, hashId, keyString) {
return {
command: this.$editor.commands.findKeyCommand(hashId, keyString)
}
};
};
this.onCommandKey = function(e, hashId, keyCode) {

View File

@@ -47,7 +47,7 @@ var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("x-palm-disable-auto-cap", true);
text.style.left = "-10000px";
parentNode.appendChild(text);
@@ -201,7 +201,7 @@ var TextInput = function(parentNode, host) {
clipboardData.setData("Text", copyText);
host.onCut();
}
event.preventDefault(e)
event.preventDefault(e);
}
});
}
@@ -213,10 +213,10 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "compositionstart", onCompositionStart);
if (useragent.isGecko) {
event.addListener(text, "text", onCompositionUpdate);
};
}
if (useragent.isWebKit) {
event.addListener(text, "keyup", onCompositionUpdate);
};
}
event.addListener(text, "compositionend", onCompositionEnd);
event.addListener(text, "blur", function() {
@@ -240,7 +240,7 @@ var TextInput = function(parentNode, host) {
function isFocused() {
return document.activeElement === text;
};
}
this.isFocused = isFocused;
this.getElement = function() {
@@ -254,12 +254,12 @@ var TextInput = function(parentNode, host) {
text.style.cssText =
'position:fixed; z-index:1000;' +
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;';
}
if (isEmpty)
text.value='';
}
};
this.onContextMenuClose = function(){
setTimeout(function () {
@@ -269,7 +269,7 @@ var TextInput = function(parentNode, host) {
}
sendText();
}, 0);
}
};
};
exports.TextInput = TextInput;

View File

@@ -180,7 +180,7 @@ exports.addMouseWheelListener = function(el, callback) {
// some versions of Safari (e.g. 5.0.5) report insanely high
// scroll values. These browsers require a higher factor
if (Math.abs(e.wheelDeltaY) > max)
max = Math.abs(e.wheelDeltaY)
max = Math.abs(e.wheelDeltaY);
if (max > 5000)
var factor = 400;
@@ -323,7 +323,7 @@ exports.addCommandKeyListener = function(el, callback) {
if (window.postMessage) {
var postMessageId = 1;
this.nextTick = function(callback, win) {
exports.nextTick = function(callback, win) {
win = win || window;
var messageName = "zero-timeout-message-" + postMessageId;
exports.addListener(win, "message", function listener(e) {
@@ -337,7 +337,7 @@ if (window.postMessage) {
};
}
else {
this.nextTick = function(callback, win) {
exports.nextTick = function(callback, win) {
win = win || window;
window.setTimeout(callback, 0);
};

View File

@@ -86,7 +86,7 @@ define(function(require, exports, module) {
regex : "(?:(?:\\.|::)\\s*)" + identifier
}, {
token : "variable",
regex : "@" + identifier
regex : "@(?:" + identifier + ")?"
}, {
token: function(value) {
if (keywords.hasOwnProperty(value))
@@ -150,15 +150,15 @@ define(function(require, exports, module) {
}, {
token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\."
}, {
token : "keyword.operator",
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|\\!)"
}, {
token : "paren.lparen",
regex : "[({[]"
}, {
token : "paren.rparen",
regex : "[\\]})]"
}, {
token : "keyword.operator",
regex : "\\S+"
}, {
token : "text",
regex : "\\s+"
@@ -179,12 +179,14 @@ define(function(require, exports, module) {
qstring : [{
token : "string",
regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
merge : true,
next : "start"
}, stringfill],
qqstring : [{
token : "string",
regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
merge : true,
next : "start"
}, stringfill],

View File

@@ -53,6 +53,13 @@ module.exports = {
var tokens = this.tokenizer.getLineTokens("for", "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, "keyword");
},
"test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;
console.log(tokens);
assert.equal(tokens.length, 12);
//assert.equal(tokens[0].type, "keyword");
}
};

View File

@@ -57,7 +57,6 @@ oop.inherits(Mode, TextMode);
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var outentedRows = [];
var re = /^(\s*)\/\//;
for (var i=startRow; i<= endRow; i++) {
@@ -96,7 +95,7 @@ oop.inherits(Mode, TextMode);
}
if (state == "start" || state == "regex_allowed") {
var match = line.match(/^.*[\{\(\[\:]\s*$/);
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
if (match) {
indent += tab;
}

View File

@@ -63,14 +63,14 @@ module.exports = {
"test: toggle comment lines should prepend '//' to each line" : function() {
var session = new EditSession([" abc", "cde", "fg"]);
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
this.mode.toggleCommentLines("start", session, 0, 1);
assert.equal(["// abc", "//cde", "fg"].join("\n"), session.toString());
},
"test: toggle comment on commented lines should remove leading '//' chars" : function() {
var session = new EditSession(["// abc", "//cde", "fg"]);
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
this.mode.toggleCommentLines("start", session, 0, 1);
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
},
@@ -85,14 +85,14 @@ module.exports = {
"test: toggle comment on multiple lines with one commented line prepend '//' to each line" : function() {
var session = new EditSession(["// abc", "//cde", "fg"]);
var comment = this.mode.toggleCommentLines("start", session, 0, 2);
this.mode.toggleCommentLines("start", session, 0, 2);
assert.equal(["//// abc", "////cde", "//fg"].join("\n"), session.toString());
},
"test: toggle comment on a comment line with leading white space": function() {
var session = new EditSession(["//cde", " //fg"]);
var comment = this.mode.toggleCommentLines("start", session, 0, 1);
this.mode.toggleCommentLines("start", session, 0, 1);
assert.equal(["cde", " fg"].join("\n"), session.toString());
},
@@ -104,6 +104,10 @@ module.exports = {
assert.equal(" ", this.mode.getNextLineIndent("start", "case 'juhu':", " "));
},
"test: no auto indent in object literal" : function() {
assert.equal("", this.mode.getNextLineIndent("start", "{ 'juhu':", " "));
},
"test: no auto indent after opening brace in multi line comment" : function() {
assert.equal("", this.mode.getNextLineIndent("start", "/*if () {", " "));
assert.equal(" ", this.mode.getNextLineIndent("comment", " abcd", " "));

View File

@@ -61,7 +61,7 @@ var VirtualRenderer = function(container, theme) {
// TODO: this breaks rendering in Cloud9 with multiple ace instances
// // Imports CSS once per DOM document ('ace_editor' serves as an identifier).
// dom.importCssString(editorCss, "ace_editor", container.ownerDocument);
// Chrome has some strange rendering issues if this is not done async
setTimeout(function() {
dom.addCssClass(container, "ace_editor");