Merge pull request #1793 from ajaxorg/misc

misc bugfix
This commit is contained in:
Ruben Daniels 2014-01-31 03:13:15 -08:00
commit 7dc4bddae9
33 changed files with 301 additions and 190 deletions

View file

@ -60,7 +60,7 @@ exports.commands = [{
module.showErrorMarker(editor, 1); module.showErrorMarker(editor, 1);
}); });
}, },
scrollIntoView: "center", scrollIntoView: "animate",
readOnly: true readOnly: true
}, { }, {
name: "goToPreviousError", name: "goToPreviousError",
@ -70,7 +70,7 @@ exports.commands = [{
module.showErrorMarker(editor, -1); module.showErrorMarker(editor, -1);
}); });
}, },
scrollIntoView: "center", scrollIntoView: "animate",
readOnly: true readOnly: true
}, { }, {
name: "selectall", name: "selectall",
@ -366,12 +366,14 @@ exports.commands = [{
bindKey: "Shift-Home", bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); }, exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true readOnly: true
}, { }, {
name: "selectlineend", name: "selectlineend",
bindKey: "Shift-End", bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); }, exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true readOnly: true
}, { }, {
name: "togglerecording", name: "togglerecording",
@ -409,21 +411,25 @@ exports.commands = [{
editor.clearSelection(); editor.clearSelection();
} }
}, },
scrollIntoView: "cursor",
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, { }, {
name: "removeline", name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"), bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); }, exec: function(editor) { editor.removeLines(); },
scrollIntoView: "cursor",
multiSelectAction: "forEachLine" multiSelectAction: "forEachLine"
}, { }, {
name: "duplicateSelection", name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); }, exec: function(editor) { editor.duplicateSelection(); },
scrollIntoView: "cursor",
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, { }, {
name: "sortlines", name: "sortlines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); }, exec: function(editor) { editor.sortLines(); },
scrollIntoView: "selection",
multiSelectAction: "forEachLine" multiSelectAction: "forEachLine"
}, { }, {
name: "togglecomment", name: "togglecomment",
@ -435,7 +441,8 @@ exports.commands = [{
name: "toggleBlockComment", name: "toggleBlockComment",
bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
exec: function(editor) { editor.toggleBlockComment(); }, exec: function(editor) { editor.toggleBlockComment(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, { }, {
name: "modifyNumberUp", name: "modifyNumberUp",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
@ -463,24 +470,29 @@ exports.commands = [{
}, { }, {
name: "copylinesup", name: "copylinesup",
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); } exec: function(editor) { editor.copyLinesUp(); },
scrollIntoView: "cursor"
}, { }, {
name: "movelinesup", name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"), bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(editor) { editor.moveLinesUp(); } exec: function(editor) { editor.moveLinesUp(); },
scrollIntoView: "cursor"
}, { }, {
name: "copylinesdown", name: "copylinesdown",
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); } exec: function(editor) { editor.copyLinesDown(); },
scrollIntoView: "cursor"
}, { }, {
name: "movelinesdown", name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"), bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(editor) { editor.moveLinesDown(); } exec: function(editor) { editor.moveLinesDown(); },
scrollIntoView: "cursor"
}, { }, {
name: "del", name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
exec: function(editor) { editor.remove("right"); }, exec: function(editor) { editor.remove("right"); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "backspace", name: "backspace",
bindKey: bindKey( bindKey: bindKey(
@ -488,7 +500,8 @@ exports.commands = [{
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
), ),
exec: function(editor) { editor.remove("left"); }, exec: function(editor) { editor.remove("left"); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "cut_or_delete", name: "cut_or_delete",
bindKey: bindKey("Shift-Delete", null), bindKey: bindKey("Shift-Delete", null),
@ -499,27 +512,32 @@ exports.commands = [{
return false; return false;
} }
}, },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removetolinestart", name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Command-Backspace"), bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); }, exec: function(editor) { editor.removeToLineStart(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removetolineend", name: "removetolineend",
bindKey: bindKey("Alt-Delete", "Ctrl-K"), bindKey: bindKey("Alt-Delete", "Ctrl-K"),
exec: function(editor) { editor.removeToLineEnd(); }, exec: function(editor) { editor.removeToLineEnd(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removewordleft", name: "removewordleft",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(editor) { editor.removeWordLeft(); }, exec: function(editor) { editor.removeWordLeft(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removewordright", name: "removewordright",
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(editor) { editor.removeWordRight(); }, exec: function(editor) { editor.removeWordRight(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "outdent", name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"), bindKey: bindKey("Shift-Tab", "Shift-Tab"),
@ -554,27 +572,32 @@ exports.commands = [{
exec: function(editor, args) { exec: function(editor, args) {
editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
}, },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "splitline", name: "splitline",
bindKey: bindKey(null, "Ctrl-O"), bindKey: bindKey(null, "Ctrl-O"),
exec: function(editor) { editor.splitLine(); }, exec: function(editor) { editor.splitLine(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "transposeletters", name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"), bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(editor) { editor.transposeLetters(); }, exec: function(editor) { editor.transposeLetters(); },
multiSelectAction: function(editor) {editor.transposeSelections(1); } multiSelectAction: function(editor) {editor.transposeSelections(1); },
scrollIntoView: "cursor"
}, { }, {
name: "touppercase", name: "touppercase",
bindKey: bindKey("Ctrl-U", "Ctrl-U"), bindKey: bindKey("Ctrl-U", "Ctrl-U"),
exec: function(editor) { editor.toUpperCase(); }, exec: function(editor) { editor.toUpperCase(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "tolowercase", name: "tolowercase",
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
exec: function(editor) { editor.toLowerCase(); }, exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}]; }];
}); });

View file

@ -4,7 +4,6 @@
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
font-size: 12px; font-size: 12px;
line-height: normal; line-height: normal;
color: black;
} }
.ace_editor .ace_line { .ace_editor .ace_line {
@ -64,6 +63,10 @@
left: 0; left: 0;
cursor: default; cursor: default;
z-index: 4; z-index: 4;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
} }
.ace_gutter-active-line { .ace_gutter-active-line {
@ -228,10 +231,6 @@
transition: opacity 0.18s; transition: opacity 0.18s;
} }
.ace_cursor[style*="opacity: 0"]{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.ace_editor.ace_multiselect .ace_cursor { .ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px; border-left-width: 1px;
} }

View file

@ -832,8 +832,9 @@ var Editor = function(renderer, session) {
// todo this should change when paste becomes a command // todo this should change when paste becomes a command
if (this.$readOnly) if (this.$readOnly)
return; return;
this._emit("paste", text); var e = {text: text};
this.insert(text); this._signal("paste", e);
this.insert(e.text, true);
}; };
@ -2309,7 +2310,7 @@ var Editor = function(renderer, session) {
* @param {Boolean} enable default true * @param {Boolean} enable default true
**/ **/
this.setAutoScrollEditorIntoView = function(enable) { this.setAutoScrollEditorIntoView = function(enable) {
if (enable === false) if (!enable)
return; return;
var rect; var rect;
var self = this; var self = this;
@ -2351,7 +2352,7 @@ var Editor = function(renderer, session) {
} }
}); });
this.setAutoScrollEditorIntoView = function(enable) { this.setAutoScrollEditorIntoView = function(enable) {
if (enable === true) if (enable)
return; return;
delete this.setAutoScrollEditorIntoView; delete this.setAutoScrollEditorIntoView;
this.removeEventListener("changeSelection", onChangeSelection); this.removeEventListener("changeSelection", onChangeSelection);
@ -2408,6 +2409,9 @@ config.defineOptions(Editor.prototype, "editor", {
}, },
behavioursEnabled: {initialValue: true}, behavioursEnabled: {initialValue: true},
wrapBehavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true},
autoScrollEditorIntoView: {
set: function(val) {this.setAutoScrollEditorIntoView(val)}
},
hScrollBarAlwaysVisible: "renderer", hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer", vScrollBarAlwaysVisible: "renderer",
@ -2419,6 +2423,7 @@ config.defineOptions(Editor.prototype, "editor", {
printMargin: "renderer", printMargin: "renderer",
fadeFoldWidgets: "renderer", fadeFoldWidgets: "renderer",
showFoldWidgets: "renderer", showFoldWidgets: "renderer",
showLineNumbers: "renderer",
showGutter: "renderer", showGutter: "renderer",
displayIndentGuides: "renderer", displayIndentGuides: "renderer",
fontSize: "renderer", fontSize: "renderer",

View file

@ -171,6 +171,8 @@ exports.showErrorMarker = function(editor, dir) {
editor.session.widgetManager.addLineWidget(w); editor.session.widgetManager.addLineWidget(w);
w.el.onmousedown = editor.focus.bind(editor); w.el.onmousedown = editor.focus.bind(editor);
editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});
}; };

View file

@ -30,8 +30,6 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
/*global define, require */
/** /**
* Generates a list of themes available when ace was built. * Generates a list of themes available when ace was built.
@ -77,7 +75,7 @@ var themeData = [
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"], ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
["Twilight" ,"twilight" , "dark"], ["Twilight" ,"twilight" , "dark"],
["Vibrant Ink" ,"vibrant_ink" , "dark"] ["Vibrant Ink" ,"vibrant_ink" , "dark"]
] ];
exports.themesByName = {}; exports.themesByName = {};
@ -88,10 +86,10 @@ exports.themesByName = {};
exports.themes = themeData.map(function(data) { exports.themes = themeData.map(function(data) {
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase(); var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
var theme = { var theme = {
caption: data[0], caption: data[0],
theme: "ace/theme/" + name, theme: "ace/theme/" + name,
isDark: data[2] == "dark", isDark: data[2] == "dark",
name: name name: name
}; };
exports.themesByName[name] = theme; exports.themesByName[name] = theme;
return theme; return theme;

View file

@ -64,6 +64,9 @@ exports.$detectIndentation = function(lines, fallback) {
while (line[line.length - 1] == "\\") while (line[line.length - 1] == "\\")
line = lines[i++]; line = lines[i++];
} }
if (!stats.length)
return;
function getScore(indent) { function getScore(indent) {
var score = 0; var score = 0;

View file

@ -100,30 +100,30 @@ exports.handler.attach = function(editor) {
editor.emacsMark = function() { editor.emacsMark = function() {
return this.session.$emacsMark; return this.session.$emacsMark;
} };
editor.setEmacsMark = function(p) { editor.setEmacsMark = function(p) {
// to deactivate pass in a falsy value // to deactivate pass in a falsy value
this.session.$emacsMark = p; this.session.$emacsMark = p;
} };
editor.pushEmacsMark = function(p, activate) { editor.pushEmacsMark = function(p, activate) {
var prevMark = this.session.$emacsMark; var prevMark = this.session.$emacsMark;
if (prevMark) if (prevMark)
this.session.$emacsMarkRing.push(prevMark); this.session.$emacsMarkRing.push(prevMark);
if (!p || activate) this.setEmacsMark(p) if (!p || activate) this.setEmacsMark(p);
else this.session.$emacsMarkRing.push(p); else this.session.$emacsMarkRing.push(p);
} };
editor.popEmacsMark = function() { editor.popEmacsMark = function() {
var mark = this.emacsMark(); var mark = this.emacsMark();
if (mark) { this.setEmacsMark(null); return mark; } if (mark) { this.setEmacsMark(null); return mark; }
return this.session.$emacsMarkRing.pop(); return this.session.$emacsMarkRing.pop();
} };
editor.getLastEmacsMark = function(p) { editor.getLastEmacsMark = function(p) {
return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0]; return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
} };
editor.on("click", $resetMarkMode); editor.on("click", $resetMarkMode);
editor.on("changeSession", $kbSessionChange); editor.on("changeSession", $kbSessionChange);
@ -163,15 +163,15 @@ var $kbSessionChange = function(e) {
e.session.$emacsMark = null; e.session.$emacsMark = null;
if (!e.session.hasOwnProperty('$emacsMarkRing')) if (!e.session.hasOwnProperty('$emacsMarkRing'))
e.session.$emacsMarkRing = []; e.session.$emacsMarkRing = [];
} };
var $resetMarkMode = function(e) { var $resetMarkMode = function(e) {
e.editor.session.$emacsMark = null; e.editor.session.$emacsMark = null;
} };
var keys = require("../lib/keys").KEY_MODS, var keys = require("../lib/keys").KEY_MODS;
eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"}, var eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"};
combinations = ["C-S-M-CMD", var combinations = ["C-S-M-CMD",
"S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M", "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
"M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S", "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
"CMD", "M", "S", "C"]; "CMD", "M", "S", "C"];
@ -188,11 +188,11 @@ exports.handler.onCopy = function(e, editor) {
editor.$handlesEmacsOnCopy = true; editor.$handlesEmacsOnCopy = true;
exports.handler.commands.killRingSave.exec(editor); exports.handler.commands.killRingSave.exec(editor);
delete editor.$handlesEmacsOnCopy; delete editor.$handlesEmacsOnCopy;
} };
exports.handler.onPaste = function(e, editor) { exports.handler.onPaste = function(e, editor) {
editor.pushEmacsMark(editor.getCursorPosition()); editor.pushEmacsMark(editor.getCursorPosition());
} };
exports.handler.bindKey = function(key, command) { exports.handler.bindKey = function(key, command) {
if (!key) if (!key)
@ -216,7 +216,7 @@ exports.handler.bindKey = function(key, command) {
if (!ckb[keyPart]) ckb[keyPart] = "null"; if (!ckb[keyPart]) ckb[keyPart] = "null";
}); });
}, this); }, this);
} };
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
var editor = data.editor; var editor = data.editor;
@ -224,7 +224,7 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (hashId == -1) { if (hashId == -1) {
editor.pushEmacsMark(); editor.pushEmacsMark();
if (data.count) { if (data.count) {
var str = Array(data.count + 1).join(key); var str = new Array(data.count + 1).join(key);
data.count = null; data.count = null;
return {command: "insertstring", args: str}; return {command: "insertstring", args: str};
} }
@ -313,7 +313,7 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
} }
}; };
} else { } else {
if (!args) args = {} if (!args) args = {};
if (typeof args === 'object') args.count = count; if (typeof args === 'object') args.count = count;
} }
} }
@ -508,8 +508,8 @@ exports.handler.addCommands({
killLine: function(editor) { killLine: function(editor) {
editor.pushEmacsMark(null); editor.pushEmacsMark(null);
var pos = editor.getCursorPosition(); var pos = editor.getCursorPosition();
if (pos.column == 0 && if (pos.column === 0 &&
editor.session.doc.getLine(pos.row).length == 0) { editor.session.doc.getLine(pos.row).length === 0) {
// If an already empty line is killed, remove // If an already empty line is killed, remove
// the line entirely // the line entirely
editor.selection.selectLine(); editor.selection.selectLine();

View file

@ -36,7 +36,7 @@ var event = require("../lib/event");
var KeyBinding = function(editor) { var KeyBinding = function(editor) {
this.$editor = editor; this.$editor = editor;
this.$data = { }; this.$data = {};
this.$handlers = []; this.$handlers = [];
this.setDefaultHandler(editor.commands); this.setDefaultHandler(editor.commands);
}; };
@ -63,6 +63,8 @@ var KeyBinding = function(editor) {
this.addKeyboardHandler = function(kb, pos) { this.addKeyboardHandler = function(kb, pos) {
if (!kb) if (!kb)
return; return;
if (typeof kb == "function" && !kb.handleKeyboard)
kb.handleKeyboard = kb;
var i = this.$handlers.indexOf(kb); var i = this.$handlers.indexOf(kb);
if (i != -1) if (i != -1)
this.$handlers.splice(i, 1); this.$handlers.splice(i, 1);

View file

@ -355,7 +355,7 @@ var TextInput = function(parentNode, host) {
// COMPOSITION // COMPOSITION
var onCompositionStart = function(e) { var onCompositionStart = function(e) {
if (inComposition) return; if (inComposition || !host.onCompositionStart) return;
// console.log("onCompositionStart", inComposition) // console.log("onCompositionStart", inComposition)
inComposition = {}; inComposition = {};
host.onCompositionStart(); host.onCompositionStart();
@ -371,7 +371,7 @@ var TextInput = function(parentNode, host) {
var onCompositionUpdate = function() { var onCompositionUpdate = function() {
// console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value)) // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
if (!inComposition) return; if (!inComposition || !host.onCompositionUpdate) return;
var val = text.value.replace(/\x01/g, ""); var val = text.value.replace(/\x01/g, "");
if (inComposition.lastValue === val) return; if (inComposition.lastValue === val) return;
@ -390,6 +390,7 @@ var TextInput = function(parentNode, host) {
}; };
var onCompositionEnd = function(e) { var onCompositionEnd = function(e) {
if (!host.onCompositionEnd) return;
// console.log("onCompositionEnd", inComposition &&inComposition.lastValue) // console.log("onCompositionEnd", inComposition &&inComposition.lastValue)
var c = inComposition; var c = inComposition;
inComposition = false; inComposition = false;

View file

@ -96,7 +96,7 @@ exports.handler = {
if (util.currentMode === "insert") { if (util.currentMode === "insert") {
this.onCompositionStartOrig(text); this.onCompositionStartOrig(text);
} }
} };
if (enable) { if (enable) {
if (!editor.onCompositionUpdateOrig) { if (!editor.onCompositionUpdateOrig) {
editor.onCompositionUpdateOrig = editor.onCompositionUpdate; editor.onCompositionUpdateOrig = editor.onCompositionUpdate;
@ -116,7 +116,7 @@ exports.handler = {
handleKeyboard: function(data, hashId, key, keyCode, e) { handleKeyboard: function(data, hashId, key, keyCode, e) {
// ignore command keys (shift, ctrl etc.) // ignore command keys (shift, ctrl etc.)
if (hashId != 0 && (key == "" || key == "\x00")) if (hashId !== 0 && (!key || keyCode == -1))
return null; return null;
var editor = data.editor; var editor = data.editor;
@ -134,7 +134,7 @@ exports.handler = {
return {command: "null", passEvent: true}; return {command: "null", passEvent: true};
} }
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} else if ((key == "esc" && hashId == 0) || key == "ctrl-[") { } else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} else if (data.state == "start") { } else if (data.state == "start") {
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
@ -142,15 +142,15 @@ exports.handler = {
key = data.inputChar; key = data.inputChar;
} }
if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) { if (hashId == -1 || hashId == 1 || hashId === 0 && key.length > 1) {
if (cmds.inputBuffer.idle && startCommands[key]) if (cmds.inputBuffer.idle && startCommands[key])
return startCommands[key]; return startCommands[key];
cmds.inputBuffer.push(editor, key); cmds.inputBuffer.push(editor, key);
return {command: "null", passEvent: false}; return {command: "null", passEvent: false};
} // if no modifier || shift: wait for input. } // if no modifier || shift: wait for input.
else if (key.length == 1 && (hashId == 0 || hashId == 4)) { else if (key.length == 1 && (hashId === 0 || hashId == 4)) {
return {command: "null", passEvent: true}; return {command: "null", passEvent: true};
} else if (key == "esc" && hashId == 0) { } else if (key == "esc" && hashId === 0) {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} }
} else { } else {

View file

@ -32,11 +32,15 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var dom = require("../lib/dom"); var dom = require("../lib/dom");
var IE8;
var Cursor = function(parentEl) { var Cursor = function(parentEl) {
this.element = dom.createElement("div"); this.element = dom.createElement("div");
this.element.className = "ace_layer ace_cursor-layer"; this.element.className = "ace_layer ace_cursor-layer";
parentEl.appendChild(this.element); parentEl.appendChild(this.element);
if (IE8 === undefined)
IE8 = "opacity" in this.element;
this.isVisible = false; this.isVisible = false;
this.isBlinking = true; this.isBlinking = true;
@ -46,9 +50,22 @@ var Cursor = function(parentEl) {
this.cursors = []; this.cursors = [];
this.cursor = this.addCursor(); this.cursor = this.addCursor();
dom.addCssClass(this.element, "ace_hidden-cursors"); dom.addCssClass(this.element, "ace_hidden-cursors");
this.$updateCursors = this.$updateVisibility.bind(this);
}; };
(function() { (function() {
this.$updateVisibility = function(val) {
var cursors = this.cursors;
for (var i = cursors.length; i--; )
cursors[i].style.visibility = val ? "" : "hidden";
};
this.$updateOpacity = function(val) {
var cursors = this.cursors;
for (var i = cursors.length; i--; )
cursors[i].style.opacity = val ? "" : "0";
};
this.$padding = 0; this.$padding = 0;
this.setPadding = function(padding) { this.setPadding = function(padding) {
@ -74,12 +91,13 @@ var Cursor = function(parentEl) {
}; };
this.setSmoothBlinking = function(smoothBlinking) { this.setSmoothBlinking = function(smoothBlinking) {
if (smoothBlinking != this.smoothBlinking) { if (smoothBlinking != this.smoothBlinking && !IE8) {
this.smoothBlinking = smoothBlinking; this.smoothBlinking = smoothBlinking;
if (smoothBlinking) dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
dom.addCssClass(this.element, "ace_smooth-blinking"); this.$updateCursors(true);
else this.$updateCursors = (smoothBlinking
dom.removeCssClass(this.element, "ace_smooth-blinking"); ? this.$updateOpacity
: this.$updateVisibility).bind(this);
this.restartTimer(); this.restartTimer();
} }
}; };
@ -113,35 +131,34 @@ var Cursor = function(parentEl) {
}; };
this.restartTimer = function() { this.restartTimer = function() {
var update = this.$updateCursors;
clearInterval(this.intervalId); clearInterval(this.intervalId);
clearTimeout(this.timeoutId); clearTimeout(this.timeoutId);
if (this.smoothBlinking) if (this.smoothBlinking) {
dom.removeCssClass(this.element, "ace_smooth-blinking"); dom.removeCssClass(this.element, "ace_smooth-blinking");
for (var i = this.cursors.length; i--; ) }
this.cursors[i].style.opacity = "";
update(true);
if (!this.isBlinking || !this.blinkInterval || !this.isVisible) if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
return; return;
if (this.smoothBlinking) if (this.smoothBlinking) {
setTimeout(function(){ setTimeout(function(){
dom.addCssClass(this.element, "ace_smooth-blinking"); dom.addCssClass(this.element, "ace_smooth-blinking");
}.bind(this)); }.bind(this));
}
var blink = function(){ var blink = function(){
this.timeoutId = setTimeout(function() { this.timeoutId = setTimeout(function() {
for (var i = this.cursors.length; i--; ) { update(false);
this.cursors[i].style.opacity = 0; }, 0.6 * this.blinkInterval);
}
}.bind(this), 0.6 * this.blinkInterval);
}.bind(this); }.bind(this);
this.intervalId = setInterval(function() { this.intervalId = setInterval(function() {
for (var i = this.cursors.length; i--; ) { update(true);
this.cursors[i].style.opacity = "";
}
blink(); blink();
}.bind(this), this.blinkInterval); }, this.blinkInterval);
blink(); blink();
}; };

View file

@ -118,9 +118,9 @@ var Gutter = function(parentEl) {
}; };
this.update = function(config) { this.update = function(config) {
var firstRow = config.firstRow;
var lastRow = config.lastRow;
var session = this.session; var session = this.session;
var firstRow = config.firstRow;
var lastRow = Math.min(config.lastRow + 1, session.getLength() - 1); // needed to compensate
var fold = session.getNextFoldLine(firstRow); var fold = session.getNextFoldLine(firstRow);
var foldStart = fold ? fold.start.row : Infinity; var foldStart = fold ? fold.start.row : Infinity;
var foldWidgets = this.$showFoldWidgets && session.foldWidgets; var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
@ -129,7 +129,7 @@ var Gutter = function(parentEl) {
var firstLineNumber = session.$firstLineNumber; var firstLineNumber = session.$firstLineNumber;
var lastLineNumber = 0; var lastLineNumber = 0;
var gutterRenderer = session.gutterRenderer; var gutterRenderer = session.gutterRenderer || this.$renderer;
var cell = null; var cell = null;
var index = -1; var index = -1;
@ -231,6 +231,19 @@ var Gutter = function(parentEl) {
this.$fixedWidth = false; this.$fixedWidth = false;
this.$showLineNumbers = true;
this.$renderer = "";
this.setShowLineNumbers = function(show) {
this.$renderer = !show && {
getWidth: function() {return ""},
getText: function() {return ""}
};
};
this.getShowLineNumbers = function() {
return this.$showLineNumbers;
};
this.$showFoldWidgets = true; this.$showFoldWidgets = true;
this.setShowFoldWidgets = function(show) { this.setShowFoldWidgets = function(show) {
if (show) if (show)

View file

@ -364,9 +364,8 @@ var Text = function(parentEl) {
container.style.height = config.lineHeight * this.session.getRowLength(row) + "px"; container.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
} else { } else {
var lines = container.childNodes while(container.firstChild)
while(lines.length) fragment.appendChild(container.firstChild);
fragment.appendChild(lines[0]);
} }
row++; row++;

View file

@ -258,11 +258,11 @@ function normalizeCommandKeys(callback, e, keyCode) {
hashId = 8; hashId = 8;
break; break;
} }
keyCode = 0; keyCode = -1;
} }
if (hashId & 8 && (keyCode === 91 || keyCode === 93)) { if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
keyCode = 0; keyCode = -1;
} }
if (!hashId && keyCode === 13) { if (!hashId && keyCode === 13) {

View file

@ -46,8 +46,8 @@ var Keys = (function() {
}, },
KEY_MODS: { KEY_MODS: {
"ctrl": 1, "alt": 2, "option" : 2, "ctrl": 1, "alt": 2, "option" : 2, "shift": 4,
"shift": 4, "meta": 8, "command": 8, "cmd": 8 "super": 8, "meta": 8, "command": 8, "cmd": 8
}, },
FUNCTION_KEYS : { FUNCTION_KEYS : {
@ -108,8 +108,15 @@ var Keys = (function() {
}; };
// A reverse map of FUNCTION_KEYS // A reverse map of FUNCTION_KEYS
for (var i in ret.FUNCTION_KEYS) { var name, i;
var name = ret.FUNCTION_KEYS[i].toLowerCase(); for (i in ret.FUNCTION_KEYS) {
name = ret.FUNCTION_KEYS[i].toLowerCase();
ret[name] = parseInt(i, 10);
}
// A reverse map of PRINTABLE_KEYS
for (i in ret.PRINTABLE_KEYS) {
name = ret.PRINTABLE_KEYS[i].toLowerCase();
ret[name] = parseInt(i, 10); ret[name] = parseInt(i, 10);
} }

View file

@ -31,6 +31,10 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
exports.last = function(a) {
return a[a.length - 1];
};
exports.stringReverse = function(string) { exports.stringReverse = function(string) {
return string.split("").reverse().join(""); return string.split("").reverse().join("");
}; };

View file

@ -179,7 +179,7 @@
["meta.tag.name.table","td"], ["meta.tag.name.table","td"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","<"], ["meta.tag.punctuation.begin","<"],
["meta.tag.name","span"], ["meta.tag.name","span"],
@ -204,12 +204,13 @@
["text"," "], ["text"," "],
["string","'file'"], ["string","'file'"],
["markup.list.meta.tag","%>"], ["markup.list.meta.tag","%>"],
["text","\">"], ["string","\""],
["meta.tag.punctuation.end",">"],
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name","span"], ["meta.tag.name","span"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","<"], ["meta.tag.punctuation.begin","<"],
["meta.tag.name.anchor","a"], ["meta.tag.name.anchor","a"],
@ -224,7 +225,8 @@
["identifier","name"], ["identifier","name"],
["text"," "], ["text"," "],
["markup.list.meta.tag","%>"], ["markup.list.meta.tag","%>"],
["text","\">"], ["string","\""],
["meta.tag.punctuation.end",">"],
["markup.list.meta.tag","<%="], ["markup.list.meta.tag","<%="],
["text"," "], ["text"," "],
["identifier","entry"], ["identifier","entry"],
@ -236,13 +238,13 @@
["meta.tag.name.anchor","a"], ["meta.tag.name.anchor","a"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name.table","td"], ["meta.tag.name.table","td"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","<"], ["meta.tag.punctuation.begin","<"],
["meta.tag.name.table","td"], ["meta.tag.name.table","td"],
@ -258,13 +260,13 @@
["meta.tag.name.table","td"], ["meta.tag.name.table","td"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name.table","tr"], ["meta.tag.name.table","tr"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["markup.list.meta.tag","<%"], ["markup.list.meta.tag","<%"],
["text"," "], ["text"," "],
@ -272,22 +274,22 @@
["text"," "], ["text"," "],
["markup.list.meta.tag","%>"] ["markup.list.meta.tag","%>"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name.table","table"], ["meta.tag.name.table","table"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "] ["text"," "]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["text"," "], ["text"," "],
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name","body"], ["meta.tag.name","body"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]
],[ ],[
["start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff","start","ejs-start","qqstring_inner","qqstring_inner","start_tag_stuff"], "start",
["meta.tag.punctuation.begin","</"], ["meta.tag.punctuation.begin","</"],
["meta.tag.name","html"], ["meta.tag.name","html"],
["meta.tag.punctuation.end",">"] ["meta.tag.punctuation.end",">"]

View file

@ -66,7 +66,7 @@ var C9SearchHighlightRules = function() {
var m; var m;
var last = 0; var last = 0;
if (regex) { if (regex && regex.exec) {
regex.lastIndex = 0; regex.lastIndex = 0;
while (m = regex.exec(str)) { while (m = regex.exec(str)) {
var skipped = str.substring(last, m.index); var skipped = str.substring(last, m.index);
@ -92,42 +92,26 @@ var C9SearchHighlightRules = function() {
regex : "Searching for .*$", regex : "Searching for .*$",
onMatch: function(val, state, stack) { onMatch: function(val, state, stack) {
var parts = val.split("\x01"); var parts = val.split("\x01");
var search = parts[1];
if (parts.length < 3) if (parts.length < 3)
return "text"; return "text";
var options = parts[2] == " in" ? parts[5] : parts[6];
if (!/regex/.test(options)) var options, search, replace;
search = lang.escapeRegExp(search);
if (/whole/.test(options))
search = "\\b" + search + "\\b";
var regex = search && safeCreateRegexp(
"(" + search + ")",
/ sensitive/.test(options) ? "g" : "ig"
);
if (regex) {
stack[0] = state;
stack[1] = regex;
}
var i = 0; var i = 0;
var tokens = [ var tokens = [{
{ value: parts[i++] + "'",
value: parts[i++] + "'", type: "text"
type: "text" }, {
}, value: search = parts[i++],
{ type: "text" // "c9searchresults.keyword"
value: parts[i++], }, {
type: "text" // "c9searchresults.keyword" value: "'" + parts[i++],
}, type: "text"
{ }];
value: "'" + parts[i++],
type: "text"
}
];
// replaced // replaced
if (parts[2] !== " in") { if (parts[2] !== " in") {
replace = parts[i];
tokens.push({ tokens.push({
value: "'" + parts[i++] + "'", value: "'" + parts[i++] + "'",
type: "text" type: "text"
@ -143,6 +127,7 @@ var C9SearchHighlightRules = function() {
}); });
// options // options
if (parts[i+1]) { if (parts[i+1]) {
options = parts[i+1];
tokens.push({ tokens.push({
value: "(" + parts[i+1] + ")", value: "(" + parts[i+1] + ")",
type: "text" type: "text"
@ -151,11 +136,33 @@ var C9SearchHighlightRules = function() {
} else { } else {
i -= 1; i -= 1;
} }
while (i++ < parts.length) while (i++ < parts.length) {
parts[i] && tokens.push({ parts[i] && tokens.push({
value: parts[i], value: parts[i],
type: "text" type: "text"
}); });
}
if (replace) {
search = replace;
options = "";
}
if (search) {
if (!/regex/.test(options))
search = lang.escapeRegExp(search);
if (/whole/.test(options))
search = "\\b" + search + "\\b";
}
var regex = search && safeCreateRegexp(
"(" + search + ")",
/ sensitive/.test(options) ? "g" : "ig"
);
if (regex) {
stack[0] = state;
stack[1] = regex;
}
return tokens; return tokens;
} }

View file

@ -6,7 +6,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
// used by objective-c // used by objective-c
var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b" var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
var c_cppHighlightRules = function() { var c_cppHighlightRules = function() {

View file

@ -50,24 +50,30 @@ oop.inherits(FoldMode, BaseFoldMode);
var level1 = /^(Found.*|Searching for.*)$/; var level1 = /^(Found.*|Searching for.*)$/;
var level2 = /^(\S.*\:|\s*)$/; var level2 = /^(\S.*\:|\s*)$/;
var re = level1.test(line) ? level1 : level2; var re = level1.test(line) ? level1 : level2;
var startRow = row;
var endRow = row;
if (this.foldingStartMarker.test(line)) { if (this.foldingStartMarker.test(line)) {
for (var i = row + 1, l = session.getLength(); i < l; i++) { for (var i = row + 1, l = session.getLength(); i < l; i++) {
if (re.test(lines[i])) if (re.test(lines[i]))
break; break;
} }
endRow = i;
return new Range(row, line.length, i, 0);
} }
else if (this.foldingStopMarker.test(line)) {
if (this.foldingStopMarker.test(line)) {
for (var i = row - 1; i >= 0; i--) { for (var i = row - 1; i >= 0; i--) {
line = lines[i]; line = lines[i];
if (re.test(line)) if (re.test(line))
break; break;
} }
startRow = i;
return new Range(i, line.length, row, 0); }
if (startRow != endRow) {
var col = line.length;
if (re === level1)
col = line.search(/\(Found[^)]+\)$|$/);
return new Range(startRow, col, endRow, 0);
} }
}; };

View file

@ -57,7 +57,7 @@ var Mode = function() {
+ unicode.packages.L + unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc + unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd + unicode.packages.Nd
+ unicode.packages.Pc + "\\$_]|\s])+", "g" + unicode.packages.Pc + "\\$_]|\\s])+", "g"
); );
this.getTokenizer = function() { this.getTokenizer = function() {
@ -217,10 +217,10 @@ var Mode = function() {
var row = iterator.getCurrentTokenRow(); var row = iterator.getCurrentTokenRow();
var column = iterator.getCurrentTokenColumn() + i; var column = iterator.getCurrentTokenColumn() + i;
startRange = new Range(row, column, row, column + comment.start.length); startRange = new Range(row, column, row, column + comment.start.length);
break break;
} }
token = iterator.stepBackward(); token = iterator.stepBackward();
}; }
var iterator = new TokenIterator(session, cursor.row, cursor.column); var iterator = new TokenIterator(session, cursor.row, cursor.column);
var token = iterator.getCurrentToken(); var token = iterator.getCurrentToken();
@ -239,10 +239,10 @@ var Mode = function() {
if (startRange) { if (startRange) {
session.remove(startRange); session.remove(startRange);
startRow = startRange.start.row; startRow = startRange.start.row;
colDiff = -comment.start.length colDiff = -comment.start.length;
} }
} else { } else {
colDiff = comment.start.length colDiff = comment.start.length;
startRow = range.start.row; startRow = range.start.row;
session.insert(range.end, comment.end); session.insert(range.end, comment.end);
session.insert(range.start, comment.start); session.insert(range.start, comment.start);
@ -284,7 +284,8 @@ var Mode = function() {
} }
} }
var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction', 'getCompletions']; var delegations = ['toggleBlockComment', 'toggleCommentLines', 'getNextLineIndent',
'checkOutdent', 'autoOutdent', 'transformAction', 'getCompletions'];
for (var i = 0; i < delegations.length; i++) { for (var i = 0; i < delegations.length; i++) {
(function(scope) { (function(scope) {
@ -292,7 +293,7 @@ var Mode = function() {
var defaultHandler = scope[functionName]; var defaultHandler = scope[functionName];
scope[delegations[i]] = function() { scope[delegations[i]] = function() {
return this.$delegator(functionName, arguments, defaultHandler); return this.$delegator(functionName, arguments, defaultHandler);
} };
} (this)); } (this));
} }
}; };
@ -364,7 +365,7 @@ var Mode = function() {
if (!this.$highlightRules) if (!this.$highlightRules)
this.getTokenizer(); this.getTokenizer();
return this.$keywordList = this.$highlightRules.$keywordList || []; return this.$keywordList = this.$highlightRules.$keywordList || [];
} };
this.getCompletions = function(state, session, pos, prefix) { this.getCompletions = function(state, session, pos, prefix) {
var keywords = this.$keywordList || this.$createKeywordList(); var keywords = this.$keywordList || this.$createKeywordList();

View file

@ -108,15 +108,14 @@ var TextHighlightRules = function() {
}; };
var pushState = function(currentState, stack) { var pushState = function(currentState, stack) {
if (currentState != "start") if (currentState != "start" || stack.length)
stack.unshift(this.nextState, currentState); stack.unshift(this.nextState, currentState);
return this.nextState; return this.nextState;
}; };
var popState = function(currentState, stack) { var popState = function(currentState, stack) {
if (stack[0] !== currentState) // if (stack[0] === currentState)
return "start";
stack.shift(); stack.shift();
return stack.shift(); return stack.shift() || "start";
}; };
this.normalizeRules = function() { this.normalizeRules = function() {

View file

@ -238,7 +238,7 @@ function DefaultHandlers(mouseHandler) {
if (ev.getAccelKey()) if (ev.getAccelKey())
return; return;
//shift wheel to horiz scroll //shift wheel to horiz scroll
if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) { if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
ev.wheelX = ev.wheelY; ev.wheelX = ev.wheelY;
ev.wheelY = 0; ev.wheelY = 0;

View file

@ -542,7 +542,10 @@ var Editor = require("./editor").Editor;
if (this.$readOnly) if (this.$readOnly)
return; return;
this._signal("paste", text);
var e = {text: text};
this._signal("paste", e);
text = e.text;
if (!this.inMultiSelectMode || this.inVirtualSelectionMode) if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
return this.insert(text); return this.insert(text);

View file

@ -143,20 +143,27 @@ var Search = function() {
if (options.$isMultiLine) { if (options.$isMultiLine) {
var len = re.length; var len = re.length;
var maxRow = lines.length - len; var maxRow = lines.length - len;
for (var row = re.offset || 0; row <= maxRow; row++) { var prevRange;
outer: for (var row = re.offset || 0; row <= maxRow; row++) {
for (var j = 0; j < len; j++) for (var j = 0; j < len; j++)
if (lines[row + j].search(re[j]) == -1) if (lines[row + j].search(re[j]) == -1)
break; continue outer;
var startLine = lines[row]; var startLine = lines[row];
var line = lines[row + len - 1]; var line = lines[row + len - 1];
var startIndex = startLine.match(re[0])[0].length; var startIndex = startLine.length - startLine.match(re[0])[0].length;
var endIndex = line.match(re[len - 1])[0].length; var endIndex = line.match(re[len - 1])[0].length;
ranges.push(new Range( if (prevRange && prevRange.end.row === row &&
row, startLine.length - startIndex, prevRange.end.column > startIndex
row + len - 1, endIndex ) {
continue;
}
ranges.push(prevRange = new Range(
row, startIndex, row + len - 1, endIndex
)); ));
if (len > 2)
row = row + len - 2;
} }
} else { } else {
for (var i = 0; i < lines.length; i++) { for (var i = 0; i < lines.length; i++) {

View file

@ -11,6 +11,7 @@
.ace-chrome { .ace-chrome {
background-color: #FFFFFF; background-color: #FFFFFF;
color: black;
} }
.ace-chrome .ace_cursor { .ace-chrome .ace_cursor {

View file

@ -10,6 +10,7 @@
.ace-dreamweaver { .ace-dreamweaver {
background-color: #FFFFFF; background-color: #FFFFFF;
color: black;
} }
.ace-dreamweaver .ace_fold { .ace-dreamweaver .ace_fold {

View file

@ -11,6 +11,7 @@
.ace-eclipse { .ace-eclipse {
background-color: #FFFFFF; background-color: #FFFFFF;
color: black;
} }
.ace-eclipse .ace_fold { .ace-eclipse .ace_fold {

View file

@ -14,6 +14,7 @@
.ace-tm { .ace-tm {
background-color: #FFFFFF; background-color: #FFFFFF;
color: black;
} }
.ace-tm .ace_cursor { .ace-tm .ace_cursor {

View file

@ -1,4 +1,3 @@
.ace-xcode .ace_gutter,
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */ /* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */
.ace-xcode .ace_gutter { .ace-xcode .ace_gutter {

View file

@ -64,6 +64,7 @@ var UndoManager = function() {
var deltas = options.args[0]; var deltas = options.args[0];
this.$doc = options.args[1]; this.$doc = options.args[1];
if (options.merge && this.hasUndo()){ if (options.merge && this.hasUndo()){
this.dirtyCounter--;
deltas = this.$undoStack.pop().concat(deltas); deltas = this.$undoStack.pop().concat(deltas);
} }
this.$undoStack.push(deltas); this.$undoStack.push(deltas);

View file

@ -369,7 +369,7 @@ var VirtualRenderer = function(container, theme) {
}; };
if (height && (force || size.height != height)) { if (height && (force || size.height != height)) {
size.height = height; size.height = height;
changes = this.CHANGE_SIZE; changes |= this.CHANGE_SIZE;
size.scrollerHeight = size.height; size.scrollerHeight = size.height;
if (this.$horizScroll) if (this.$horizScroll)
@ -378,14 +378,11 @@ var VirtualRenderer = function(container, theme) {
// this.scrollBarV.setHeight(size.scrollerHeight); // this.scrollBarV.setHeight(size.scrollerHeight);
this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px"; this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
if (this.session) { changes = changes | this.CHANGE_SCROLL;
//this.session.setScrollTop(this.getScrollTop());
changes = changes | this.CHANGE_SCROLL;
}
} }
if (width && (force || size.width != width)) { if (width && (force || size.width != width)) {
changes = this.CHANGE_SIZE; changes |= this.CHANGE_SIZE;
size.width = width; size.width = width;
if (gutterWidth == null) if (gutterWidth == null)
@ -404,7 +401,7 @@ var VirtualRenderer = function(container, theme) {
// this.scrollBarH.element.style.setWidth(size.scrollerWidth); // this.scrollBarH.element.style.setWidth(size.scrollerWidth);
if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
changes = changes | this.CHANGE_FULL; changes |= this.CHANGE_FULL;
} }
size.$dirty = !width || !height; size.$dirty = !width || !height;
@ -897,18 +894,19 @@ var VirtualRenderer = function(container, theme) {
this.$autosize(); this.$autosize();
var session = this.session; var session = this.session;
var size = this.$size;
var hideScrollbars = this.$size.height <= 2 * this.lineHeight; var hideScrollbars = size.height <= 2 * this.lineHeight;
var screenLines = this.session.getScreenLength(); var screenLines = this.session.getScreenLength();
var maxHeight = screenLines * this.lineHeight; var maxHeight = screenLines * this.lineHeight;
var offset = this.scrollTop % this.lineHeight; var offset = this.scrollTop % this.lineHeight;
var minHeight = this.$size.scrollerHeight + this.lineHeight; var minHeight = size.scrollerHeight + this.lineHeight;
var longestLine = this.$getLongestLine(); var longestLine = this.$getLongestLine();
var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible || var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
this.$size.scrollerWidth - longestLine - 2 * this.$padding < 0); size.scrollerWidth - longestLine - 2 * this.$padding < 0);
var hScrollChanged = this.$horizScroll !== horizScroll; var hScrollChanged = this.$horizScroll !== horizScroll;
if (hScrollChanged) { if (hScrollChanged) {
@ -917,15 +915,15 @@ var VirtualRenderer = function(container, theme) {
} }
if (!this.$maxLines && this.$scrollPastEnd) { if (!this.$maxLines && this.$scrollPastEnd) {
if (this.scrollTop > maxHeight - this.$size.scrollerHeight) if (this.scrollTop > maxHeight - size.scrollerHeight)
maxHeight += Math.min( maxHeight += Math.min(
(this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd, (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd,
this.scrollTop - maxHeight + this.$size.scrollerHeight this.scrollTop - maxHeight + size.scrollerHeight
); );
} }
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible || var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
this.$size.scrollerHeight - maxHeight < 0); size.scrollerHeight - maxHeight < 0);
var vScrollChanged = this.$vScroll !== vScroll; var vScrollChanged = this.$vScroll !== vScroll;
if (vScrollChanged) { if (vScrollChanged) {
this.$vScroll = vScroll; this.$vScroll = vScroll;
@ -933,10 +931,10 @@ var VirtualRenderer = function(container, theme) {
} }
this.session.setScrollTop(Math.max(-this.scrollMargin.top, this.session.setScrollTop(Math.max(-this.scrollMargin.top,
Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight + this.scrollMargin.v))); Math.min(this.scrollTop, maxHeight - size.scrollerHeight + this.scrollMargin.bottom)));
this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft, this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft,
longestLine + 2 * this.$padding - this.$size.scrollerWidth + this.scrollMargin.h))); longestLine + 2 * this.$padding - size.scrollerWidth + this.scrollMargin.right)));
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1; var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight)); var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
@ -958,16 +956,18 @@ var VirtualRenderer = function(container, theme) {
firstRowHeight = session.getRowLength(firstRow) * lineHeight; firstRowHeight = session.getRowLength(firstRow) * lineHeight;
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1); lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight + minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
firstRowHeight; firstRowHeight;
offset = this.scrollTop - firstRowScreen * lineHeight; offset = this.scrollTop - firstRowScreen * lineHeight;
var changes = 0; var changes = 0;
if (this.layerConfig.width != longestLine)
changes = this.CHANGE_H_SCROLL;
// Horizontal scrollbar visibility may have changed, which changes // Horizontal scrollbar visibility may have changed, which changes
// the client height of the scroller // the client height of the scroller
if (hScrollChanged || vScrollChanged) { if (hScrollChanged || vScrollChanged) {
changes = this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height); changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
this._signal("scrollbarVisibilityChanged"); this._signal("scrollbarVisibilityChanged");
if (vScrollChanged) if (vScrollChanged)
longestLine = this.$getLongestLine(); longestLine = this.$getLongestLine();
@ -984,6 +984,7 @@ var VirtualRenderer = function(container, theme) {
minHeight : minHeight, minHeight : minHeight,
maxHeight : maxHeight, maxHeight : maxHeight,
offset : offset, offset : offset,
gutterOffset : Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight),
height : this.$size.scrollerHeight height : this.$size.scrollerHeight
}; };
@ -1113,7 +1114,7 @@ var VirtualRenderer = function(container, theme) {
* *
* Scrolls the cursor into the first visibile area of the editor * Scrolls the cursor into the first visibile area of the editor
**/ **/
this.scrollCursorIntoView = function(cursor, offset) { this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {
// the editor is not visible // the editor is not visible
if (this.$size.scrollerHeight === 0) if (this.$size.scrollerHeight === 0)
return; return;
@ -1123,17 +1124,18 @@ var VirtualRenderer = function(container, theme) {
var left = pos.left; var left = pos.left;
var top = pos.top; var top = pos.top;
var topMargin = $viewMargin && $viewMargin.top || 0;
var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop; var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
if (scrollTop > top) { if (scrollTop + topMargin > top) {
if (offset) if (offset)
top -= offset * this.$size.scrollerHeight; top -= offset * this.$size.scrollerHeight;
if (top == 0) if (top === 0)
top = - this.scrollMargin.top; top = -this.scrollMargin.top;
else if (top == 0)
top = + this.scrollMargin.bottom;
this.session.setScrollTop(top); this.session.setScrollTop(top);
} else if (scrollTop + this.$size.scrollerHeight < top + this.lineHeight) { } else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {
if (offset) if (offset)
top += offset * this.$size.scrollerHeight; top += offset * this.$size.scrollerHeight;
this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight); this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
@ -1617,6 +1619,13 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)}, set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)},
initialValue: true initialValue: true
}, },
showLineNumbers: {
set: function(show) {
this.$gutterLayer.setShowLineNumbers(show);
this.$loop.schedule(this.CHANGE_GUTTER);
},
initialValue: true
},
displayIndentGuides: { displayIndentGuides: {
set: function(show) { set: function(show) {
if (this.$textLayer.setDisplayIndentGuides(show)) if (this.$textLayer.setDisplayIndentGuides(show))

View file

@ -17,7 +17,7 @@ window.window = window;
window.ace = window; window.ace = window;
window.onerror = function(message, file, line, col, err) { window.onerror = function(message, file, line, col, err) {
console.error("Worker " + err.stack); console.error("Worker " + (err ? err.stack : message));
}; };
window.normalizeModule = function(parentId, moduleName) { window.normalizeModule = function(parentId, moduleName) {