From b9fc94ef6ca541a1a6513f839ab6f1cc949c46bb Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 29 Nov 2011 09:16:53 -0800 Subject: [PATCH] update ace to cd271f1a8bd33712f90dc91d0105bc6674e8c6a4 --- vendor/ace/commands/default_commands.js | 6 +++--- vendor/ace/css/editor.css | 2 +- vendor/ace/keyboard/keybinding.js | 8 ++++---- vendor/ace/keyboard/textinput.js | 16 ++++++++-------- vendor/ace/lib/event.js | 6 +++--- vendor/ace/mode/coffee_highlight_rules.js | 10 ++++++---- vendor/ace/mode/coffee_tokenizer_test.js | 7 +++++++ vendor/ace/mode/javascript.js | 3 +-- vendor/ace/mode/javascript_test.js | 12 ++++++++---- vendor/ace/virtual_renderer.js | 2 +- 10 files changed, 42 insertions(+), 30 deletions(-) diff --git a/vendor/ace/commands/default_commands.js b/vendor/ace/commands/default_commands.js index aad471982..138d11c6f 100644 --- a/vendor/ace/commands/default_commands.js +++ b/vendor/ace/commands/default_commands.js @@ -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 { diff --git a/vendor/ace/css/editor.css b/vendor/ace/css/editor.css index 3fb78a903..5f30877e9 100644 --- a/vendor/ace/css/editor.css +++ b/vendor/ace/css/editor.css @@ -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 { diff --git a/vendor/ace/keyboard/keybinding.js b/vendor/ace/keyboard/keybinding.js index e1ab4fafc..9caa76da3 100644 --- a/vendor/ace/keyboard/keybinding.js +++ b/vendor/ace/keyboard/keybinding.js @@ -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) { diff --git a/vendor/ace/keyboard/textinput.js b/vendor/ace/keyboard/textinput.js index 5acdb8619..b828dcf65 100644 --- a/vendor/ace/keyboard/textinput.js +++ b/vendor/ace/keyboard/textinput.js @@ -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; diff --git a/vendor/ace/lib/event.js b/vendor/ace/lib/event.js index f8094417e..761d00e2c 100644 --- a/vendor/ace/lib/event.js +++ b/vendor/ace/lib/event.js @@ -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); }; diff --git a/vendor/ace/mode/coffee_highlight_rules.js b/vendor/ace/mode/coffee_highlight_rules.js index 9bea4d58c..ca5a0b9b0 100644 --- a/vendor/ace/mode/coffee_highlight_rules.js +++ b/vendor/ace/mode/coffee_highlight_rules.js @@ -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], diff --git a/vendor/ace/mode/coffee_tokenizer_test.js b/vendor/ace/mode/coffee_tokenizer_test.js index 9eeb55a23..20f8146d9 100644 --- a/vendor/ace/mode/coffee_tokenizer_test.js +++ b/vendor/ace/mode/coffee_tokenizer_test.js @@ -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"); } }; diff --git a/vendor/ace/mode/javascript.js b/vendor/ace/mode/javascript.js index 38553837d..41929c90b 100644 --- a/vendor/ace/mode/javascript.js +++ b/vendor/ace/mode/javascript.js @@ -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; } diff --git a/vendor/ace/mode/javascript_test.js b/vendor/ace/mode/javascript_test.js index 1349eb1a6..fc542d441 100644 --- a/vendor/ace/mode/javascript_test.js +++ b/vendor/ace/mode/javascript_test.js @@ -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", " ")); diff --git a/vendor/ace/virtual_renderer.js b/vendor/ace/virtual_renderer.js index 07f424caf..b491106ae 100644 --- a/vendor/ace/virtual_renderer.js +++ b/vendor/ace/virtual_renderer.js @@ -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");