Merge commit '6808e3bb35'
Conflicts: .gitmodules Makefile.dryice.js demo/demo.js demo/kitchen-sink/boot.js kitchen-sink.html lib/ace/commands/default_commands.js lib/ace/test/tests.html package.json support/pilot
This commit is contained in:
parent
22274e4d4c
commit
62a3b4edf5
18 changed files with 704 additions and 808 deletions
|
|
@ -41,7 +41,6 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var lang = require("pilot/lang");
|
||||
var canon = require("pilot/canon");
|
||||
|
||||
function bindKey(win, mac) {
|
||||
return {
|
||||
|
|
@ -51,58 +50,46 @@ function bindKey(win, mac) {
|
|||
};
|
||||
}
|
||||
|
||||
canon.addCommand({
|
||||
name: "null",
|
||||
exec: function(env, args, request) { }
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
exports.commands = [{
|
||||
name: "selectall",
|
||||
bindKey: bindKey("Ctrl-A", "Command-A"),
|
||||
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.selectAll(); }
|
||||
}, {
|
||||
name: "removeline",
|
||||
bindKey: bindKey("Ctrl-D", "Command-D"),
|
||||
exec: function(env, args, request) { env.editor.removeLines(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeLines(); }
|
||||
}, {
|
||||
name: "gotoline",
|
||||
bindKey: bindKey("Ctrl-L", "Command-L"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
var line = parseInt(prompt("Enter line number:"));
|
||||
if (!isNaN(line)) {
|
||||
env.editor.gotoLine(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "togglecomment",
|
||||
bindKey: bindKey("Ctrl-7", "Command-7"),
|
||||
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.toggleCommentLines(); }
|
||||
}, {
|
||||
name: "findnext",
|
||||
bindKey: bindKey("Ctrl-K", "Command-G"),
|
||||
exec: function(env, args, request) { env.editor.findNext(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.findNext(); }
|
||||
}, {
|
||||
name: "findprevious",
|
||||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(env, args, request) { env.editor.findPrevious(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.findPrevious(); }
|
||||
}, {
|
||||
name: "find",
|
||||
bindKey: bindKey("Ctrl-F", "Command-F"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
var needle = prompt("Find:", env.editor.getCopyText());
|
||||
env.editor.find(needle);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "replace",
|
||||
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
var needle = prompt("Find:", env.editor.getCopyText());
|
||||
if (!needle)
|
||||
return;
|
||||
|
|
@ -111,11 +98,10 @@ canon.addCommand({
|
|||
return;
|
||||
env.editor.replace(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "replaceall",
|
||||
bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
var needle = prompt("Find:");
|
||||
if (!needle)
|
||||
return;
|
||||
|
|
@ -124,274 +110,222 @@ canon.addCommand({
|
|||
return;
|
||||
env.editor.replaceAll(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "undo",
|
||||
bindKey: bindKey("Ctrl-Z", "Command-Z"),
|
||||
exec: function(env, args, request) { env.editor.undo(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.undo(); }
|
||||
}, {
|
||||
name: "redo",
|
||||
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
|
||||
exec: function(env, args, request) { env.editor.redo(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.redo(); }
|
||||
}, {
|
||||
name: "overwrite",
|
||||
bindKey: bindKey("Insert", "Insert"),
|
||||
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.toggleOverwrite(); }
|
||||
}, {
|
||||
name: "copylinesup",
|
||||
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.copyLinesUp(); }
|
||||
}, {
|
||||
name: "movelinesup",
|
||||
bindKey: bindKey("Alt-Up", "Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.moveLinesUp(); }
|
||||
}, {
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectFileStart(); }
|
||||
}, {
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateFileStart(); }
|
||||
}, {
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectUp(); }
|
||||
}, {
|
||||
name: "golineup",
|
||||
bindKey: bindKey("Up", "Up|Ctrl-P"),
|
||||
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateUp(args.times); }
|
||||
}, {
|
||||
name: "copylinesdown",
|
||||
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.copyLinesDown(); }
|
||||
}, {
|
||||
name: "movelinesdown",
|
||||
bindKey: bindKey("Alt-Down", "Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.moveLinesDown(); }
|
||||
}, {
|
||||
name: "selecttoend",
|
||||
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectFileEnd(); }
|
||||
}, {
|
||||
name: "gotoend",
|
||||
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateFileEnd(); }
|
||||
}, {
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectDown(); }
|
||||
}, {
|
||||
name: "golinedown",
|
||||
bindKey: bindKey("Down", "Down|Ctrl-N"),
|
||||
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateDown(args.times); }
|
||||
}, {
|
||||
name: "selectwordleft",
|
||||
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectWordLeft(); }
|
||||
}, {
|
||||
name: "gotowordleft",
|
||||
bindKey: bindKey("Ctrl-Left", "Option-Left"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateWordLeft(); }
|
||||
}, {
|
||||
name: "selecttolinestart",
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
|
||||
}, {
|
||||
name: "gotolinestart",
|
||||
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateLineStart(); }
|
||||
}, {
|
||||
name: "selectleft",
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectLeft(); }
|
||||
}, {
|
||||
name: "gotoleft",
|
||||
bindKey: bindKey("Left", "Left|Ctrl-B"),
|
||||
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateLeft(args.times); }
|
||||
}, {
|
||||
name: "selectwordright",
|
||||
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectWordRight(); }
|
||||
}, {
|
||||
name: "gotowordright",
|
||||
bindKey: bindKey("Ctrl-Right", "Option-Right"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateWordRight(); }
|
||||
}, {
|
||||
name: "selecttolineend",
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
|
||||
}, {
|
||||
name: "gotolineend",
|
||||
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateLineEnd(); }
|
||||
}, {
|
||||
name: "selectright",
|
||||
bindKey: bindKey("Shift-Right", "Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectRight(); }
|
||||
}, {
|
||||
name: "gotoright",
|
||||
bindKey: bindKey("Right", "Right|Ctrl-F"),
|
||||
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.navigateRight(args.times); }
|
||||
}, {
|
||||
name: "selectpagedown",
|
||||
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
|
||||
exec: function(env, args, request) { env.editor.selectPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.selectPageDown(); }
|
||||
}, {
|
||||
name: "pagedown",
|
||||
bindKey: bindKey(null, "PageDown"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.scrollPageDown(); }
|
||||
}, {
|
||||
name: "gotopagedown",
|
||||
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.gotoPageDown(); }
|
||||
}, {
|
||||
name: "selectpageup",
|
||||
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.selectPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.selectPageUp(); }
|
||||
}, {
|
||||
name: "pageup",
|
||||
bindKey: bindKey(null, "PageUp"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.scrollPageUp(); }
|
||||
}, {
|
||||
name: "gotopageup",
|
||||
bindKey: bindKey("PageUp", "Option-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.gotoPageUp(); }
|
||||
}, {
|
||||
name: "selectlinestart",
|
||||
bindKey: bindKey("Shift-Home", "Shift-Home"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
|
||||
}, {
|
||||
name: "selectlineend",
|
||||
bindKey: bindKey("Shift-End", "Shift-End"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
|
||||
}, {
|
||||
name: "del",
|
||||
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
|
||||
exec: function(env, args, request) { env.editor.remove("right"); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.remove("right"); }
|
||||
}, {
|
||||
name: "backspace",
|
||||
bindKey: bindKey(
|
||||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||
),
|
||||
exec: function(env, args, request) { env.editor.remove("left"); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeLeft(); }
|
||||
}, {
|
||||
name: "removetolinestart",
|
||||
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeToLineStart(); }
|
||||
}, {
|
||||
name: "removetolineend",
|
||||
bindKey: bindKey("Alt-Delete", "Ctrl-K"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeToLineEnd(); }
|
||||
}, {
|
||||
name: "removewordleft",
|
||||
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeWordLeft(); }
|
||||
}, {
|
||||
name: "removewordright",
|
||||
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
|
||||
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.removeWordRight(); }
|
||||
}, {
|
||||
name: "outdent",
|
||||
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
|
||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.blockOutdent(); }
|
||||
}, {
|
||||
name: "indent",
|
||||
bindKey: bindKey("Tab", "Tab"),
|
||||
exec: function(env, args, request) { env.editor.indent(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.indent(); }
|
||||
}, {
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
exec: function(env, args) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "centerselection",
|
||||
bindKey: bindKey(null, "Ctrl-L"),
|
||||
exec: function(env, args, request) { env.editor.centerSelection(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.centerSelection(); }
|
||||
}, {
|
||||
name: "splitline",
|
||||
bindKey: bindKey(null, "Ctrl-O"),
|
||||
exec: function(env, args, request) { env.editor.splitLine(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.splitLine(); }
|
||||
}, {
|
||||
name: "transposeletters",
|
||||
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
|
||||
exec: function(env, args, request) { env.editor.transposeLetters(); }
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
exec: function(env, args) { env.editor.transposeLetters(); }
|
||||
}, {
|
||||
name: "fold",
|
||||
bindKey: bindKey("Alt-L", "Alt-L"),
|
||||
exec: function(env) {
|
||||
env.editor.session.toggleFold(false);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "unfold",
|
||||
bindKey: bindKey("Alt-Shift-L", "Alt-Shift-L"),
|
||||
exec: function(env) {
|
||||
env.editor.session.toggleFold(true);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "foldall",
|
||||
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
|
||||
exec: function(env) {
|
||||
env.editor.session.foldAll();
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "unfoldall",
|
||||
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
|
||||
exec: function(env) {
|
||||
env.editor.session.unFoldAll();
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue