remove request argument to commands

This commit is contained in:
Fabian Jakobs 2011-07-23 12:41:20 +02:00
commit 8d0e1784e2

View file

@ -53,23 +53,23 @@ function bindKey(win, mac) {
commands.addCommand({
name: "null",
exec: function(env, args, request) { }
exec: function(env, args) { }
});
commands.addCommand({
name: "selectall",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(env, args, request) { env.editor.selectAll(); }
exec: function(env, args) { env.editor.selectAll(); }
});
commands.addCommand({
name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(env, args, request) { env.editor.removeLines(); }
exec: function(env, args) { env.editor.removeLines(); }
});
commands.addCommand({
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);
@ -79,22 +79,22 @@ commands.addCommand({
commands.addCommand({
name: "togglecomment",
bindKey: bindKey("Ctrl-7", "Command-7"),
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
exec: function(env, args) { env.editor.toggleCommentLines(); }
});
commands.addCommand({
name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(env, args, request) { env.editor.findNext(); }
exec: function(env, args) { env.editor.findNext(); }
});
commands.addCommand({
name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(env, args, request) { env.editor.findPrevious(); }
exec: function(env, args) { env.editor.findPrevious(); }
});
commands.addCommand({
name: "find",
bindKey: bindKey("Ctrl-F", "Command-F"),
exec: function(env, args, request) {
exec: function(env, args) {
var needle = prompt("Find:");
env.editor.find(needle);
}
@ -102,7 +102,7 @@ commands.addCommand({
commands.addCommand({
name: "replace",
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
exec: function(env, args, request) {
exec: function(env, args) {
var needle = prompt("Find:");
if (!needle)
return;
@ -115,7 +115,7 @@ commands.addCommand({
commands.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;
@ -128,182 +128,182 @@ commands.addCommand({
commands.addCommand({
name: "undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(env, args, request) { env.editor.undo(); }
exec: function(env, args) { env.editor.undo(); }
});
commands.addCommand({
name: "redo",
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
exec: function(env, args, request) { env.editor.redo(); }
exec: function(env, args) { env.editor.redo(); }
});
commands.addCommand({
name: "overwrite",
bindKey: bindKey("Insert", "Insert"),
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
exec: function(env, args) { env.editor.toggleOverwrite(); }
});
commands.addCommand({
name: "copylinesup",
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
exec: function(env, args, request) { env.editor.copyLinesUp(); }
exec: function(env, args) { env.editor.copyLinesUp(); }
});
commands.addCommand({
name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(env, args, request) { env.editor.moveLinesUp(); }
exec: function(env, args) { env.editor.moveLinesUp(); }
});
commands.addCommand({
name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
exec: function(env, args) { env.editor.getSelection().selectFileStart(); }
});
commands.addCommand({
name: "gotostart",
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
exec: function(env, args, request) { env.editor.navigateFileStart(); }
exec: function(env, args) { env.editor.navigateFileStart(); }
});
commands.addCommand({
name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
exec: function(env, args) { env.editor.getSelection().selectUp(); }
});
commands.addCommand({
name: "golineup",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
exec: function(env, args) { env.editor.navigateUp(args.times); }
});
commands.addCommand({
name: "copylinesdown",
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
exec: function(env, args, request) { env.editor.copyLinesDown(); }
exec: function(env, args) { env.editor.copyLinesDown(); }
});
commands.addCommand({
name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(env, args, request) { env.editor.moveLinesDown(); }
exec: function(env, args) { env.editor.moveLinesDown(); }
});
commands.addCommand({
name: "selecttoend",
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
exec: function(env, args) { env.editor.getSelection().selectFileEnd(); }
});
commands.addCommand({
name: "gotoend",
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
exec: function(env, args) { env.editor.navigateFileEnd(); }
});
commands.addCommand({
name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
exec: function(env, args) { env.editor.getSelection().selectDown(); }
});
commands.addCommand({
name: "golinedown",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
exec: function(env, args) { env.editor.navigateDown(args.times); }
});
commands.addCommand({
name: "selectwordleft",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
exec: function(env, args) { env.editor.getSelection().selectWordLeft(); }
});
commands.addCommand({
name: "gotowordleft",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
exec: function(env, args) { env.editor.navigateWordLeft(); }
});
commands.addCommand({
name: "selecttolinestart",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
});
commands.addCommand({
name: "gotolinestart",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(env, args, request) { env.editor.navigateLineStart(); }
exec: function(env, args) { env.editor.navigateLineStart(); }
});
commands.addCommand({
name: "selectleft",
bindKey: bindKey("Shift-Left", "Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
exec: function(env, args) { env.editor.getSelection().selectLeft(); }
});
commands.addCommand({
name: "gotoleft",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
exec: function(env, args) { env.editor.navigateLeft(args.times); }
});
commands.addCommand({
name: "selectwordright",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
exec: function(env, args) { env.editor.getSelection().selectWordRight(); }
});
commands.addCommand({
name: "gotowordright",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(env, args, request) { env.editor.navigateWordRight(); }
exec: function(env, args) { env.editor.navigateWordRight(); }
});
commands.addCommand({
name: "selecttolineend",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
});
commands.addCommand({
name: "gotolineend",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
exec: function(env, args) { env.editor.navigateLineEnd(); }
});
commands.addCommand({
name: "selectright",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
exec: function(env, args) { env.editor.getSelection().selectRight(); }
});
commands.addCommand({
name: "gotoright",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
exec: function(env, args) { env.editor.navigateRight(args.times); }
});
commands.addCommand({
name: "selectpagedown",
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
exec: function(env, args, request) { env.editor.selectPageDown(); }
exec: function(env, args) { env.editor.selectPageDown(); }
});
commands.addCommand({
name: "pagedown",
bindKey: bindKey(null, "PageDown"),
exec: function(env, args, request) { env.editor.scrollPageDown(); }
exec: function(env, args) { env.editor.scrollPageDown(); }
});
commands.addCommand({
name: "gotopagedown",
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
exec: function(env, args, request) { env.editor.gotoPageDown(); }
exec: function(env, args) { env.editor.gotoPageDown(); }
});
commands.addCommand({
name: "selectpageup",
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
exec: function(env, args, request) { env.editor.selectPageUp(); }
exec: function(env, args) { env.editor.selectPageUp(); }
});
commands.addCommand({
name: "pageup",
bindKey: bindKey(null, "PageUp"),
exec: function(env, args, request) { env.editor.scrollPageUp(); }
exec: function(env, args) { env.editor.scrollPageUp(); }
});
commands.addCommand({
name: "gotopageup",
bindKey: bindKey("PageUp", "Option-PageUp"),
exec: function(env, args, request) { env.editor.gotoPageUp(); }
exec: function(env, args) { env.editor.gotoPageUp(); }
});
commands.addCommand({
name: "selectlinestart",
bindKey: bindKey("Shift-Home", "Shift-Home"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
exec: function(env, args) { env.editor.getSelection().selectLineStart(); }
});
commands.addCommand({
name: "selectlineend",
bindKey: bindKey("Shift-End", "Shift-End"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
exec: function(env, args) { env.editor.getSelection().selectLineEnd(); }
});
commands.addCommand({
name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
exec: function(env, args, request) { env.editor.removeRight(); }
exec: function(env, args) { env.editor.removeRight(); }
});
commands.addCommand({
name: "backspace",
@ -311,58 +311,58 @@ commands.addCommand({
"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.removeLeft(); }
exec: function(env, args) { env.editor.removeLeft(); }
});
commands.addCommand({
name: "removetolinestart",
bindKey: bindKey(null, "Option-Backspace"),
exec: function(env, args, request) { env.editor.removeToLineStart(); }
exec: function(env, args) { env.editor.removeToLineStart(); }
});
commands.addCommand({
name: "removetolineend",
bindKey: bindKey(null, "Ctrl-K"),
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
exec: function(env, args) { env.editor.removeToLineEnd(); }
});
commands.addCommand({
name: "removewordleft",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(env, args, request) { env.editor.removeWordLeft(); }
exec: function(env, args) { env.editor.removeWordLeft(); }
});
commands.addCommand({
name: "removewordright",
bindKey: bindKey(null, "Alt-Delete"),
exec: function(env, args, request) { env.editor.removeWordRight(); }
exec: function(env, args) { env.editor.removeWordRight(); }
});
commands.addCommand({
name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(env, args, request) { env.editor.blockOutdent(); }
exec: function(env, args) { env.editor.blockOutdent(); }
});
commands.addCommand({
name: "indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(env, args, request) { env.editor.indent(); }
exec: function(env, args) { env.editor.indent(); }
});
commands.addCommand({
name: "inserttext",
exec: function(env, args, request) {
exec: function(env, args) {
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
}
});
commands.addCommand({
name: "centerselection",
bindKey: bindKey(null, "Ctrl-L"),
exec: function(env, args, request) { env.editor.centerSelection(); }
exec: function(env, args) { env.editor.centerSelection(); }
});
commands.addCommand({
name: "splitline",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(env, args, request) { env.editor.splitLine(); }
exec: function(env, args) { env.editor.splitLine(); }
});
commands.addCommand({
name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(env, args, request) { env.editor.transposeLetters(); }
exec: function(env, args) { env.editor.transposeLetters(); }
});
});