diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index 11c7984b..3bc14648 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -41,7 +41,7 @@ define(function(require, exports, module) { var lang = require("pilot/lang"); -var canon = require("cockpit/canon"); +var gcli = require("cockpit/index"); function bindKey(win, mac) { return { @@ -55,22 +55,22 @@ function bindKey(win, mac) { * TODO: This could be done more concisely and reversibly */ exports.startup = function() { - canon.addCommand({ + gcli.addCommand({ name: "null", exec: function(env, args, request) { } }); - canon.addCommand({ + gcli.addCommand({ name: "selectall", bindKey: bindKey("Ctrl-A", "Command-A"), exec: function(env, args, request) { env.editor.selectAll(); } }); - canon.addCommand({ + gcli.addCommand({ name: "removeline", bindKey: bindKey("Ctrl-D", "Command-D"), exec: function(env, args, request) { env.editor.removeLines(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotoline", description: "Move the cursor to the given line", bindKey: bindKey("Ctrl-L", "Command-L"), @@ -87,22 +87,22 @@ exports.startup = function() { env.editor.gotoLine(args.line); } }); - canon.addCommand({ + gcli.addCommand({ name: "togglecomment", bindKey: bindKey("Ctrl-7", "Command-7"), exec: function(env, args, request) { env.editor.toggleCommentLines(); } }); - canon.addCommand({ + gcli.addCommand({ name: "findnext", bindKey: bindKey("Ctrl-K", "Command-G"), exec: function(env, args, request) { env.editor.findNext(); } }); - canon.addCommand({ + gcli.addCommand({ name: "findprevious", bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), exec: function(env, args, request) { env.editor.findPrevious(); } }); - canon.addCommand({ + gcli.addCommand({ name: "find", description: "Search for the next instance of a string", bindKey: bindKey("Ctrl-F", "Command-F"), @@ -117,7 +117,7 @@ exports.startup = function() { env.editor.find(args.findWhat); } }); - canon.addCommand({ + gcli.addCommand({ name: "replace", description: "Replace the next instance of a string with a given replacement", bindKey: bindKey("Ctrl-R", "Command-Option-F"), @@ -140,7 +140,7 @@ exports.startup = function() { env.editor.replace(args.replacement, {needle: args.findWhat}); } }); - canon.addCommand({ + gcli.addCommand({ name: "replaceall", description: "Replace all instances of a string with a given replacement", bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"), @@ -163,187 +163,187 @@ exports.startup = function() { env.editor.replaceAll(args.replacement, {needle: args.findWhat}); } }); - canon.addCommand({ + gcli.addCommand({ name: "undo", bindKey: bindKey("Ctrl-Z", "Command-Z"), exec: function(env, args, request) { env.editor.undo(); } }); - canon.addCommand({ + gcli.addCommand({ name: "redo", bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), exec: function(env, args, request) { env.editor.redo(); } }); - canon.addCommand({ + gcli.addCommand({ name: "overwrite", bindKey: bindKey("Insert", "Insert"), exec: function(env, args, request) { env.editor.toggleOverwrite(); } }); - canon.addCommand({ + gcli.addCommand({ name: "copylinesup", bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"), exec: function(env, args, request) { env.editor.copyLinesUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "movelinesup", bindKey: bindKey("Alt-Up", "Option-Up"), exec: function(env, args, request) { env.editor.moveLinesUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selecttostart", bindKey: bindKey("Alt-Shift-Up", "Command-Shift-Up"), exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotostart", bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"), exec: function(env, args, request) { env.editor.navigateFileStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectup", bindKey: bindKey("Shift-Up", "Shift-Up"), exec: function(env, args, request) { env.editor.getSelection().selectUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "golineup", bindKey: bindKey("Up", "Up|Ctrl-P"), exec: function(env, args, request) { env.editor.navigateUp(args.times); } }); - canon.addCommand({ + gcli.addCommand({ name: "copylinesdown", bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"), exec: function(env, args, request) { env.editor.copyLinesDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "movelinesdown", bindKey: bindKey("Alt-Down", "Option-Down"), exec: function(env, args, request) { env.editor.moveLinesDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selecttoend", bindKey: bindKey("Alt-Shift-Down", "Command-Shift-Down"), exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotoend", bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"), exec: function(env, args, request) { env.editor.navigateFileEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectdown", bindKey: bindKey("Shift-Down", "Shift-Down"), exec: function(env, args, request) { env.editor.getSelection().selectDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "golinedown", bindKey: bindKey("Down", "Down|Ctrl-N"), exec: function(env, args, request) { env.editor.navigateDown(args.times); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectwordleft", bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotowordleft", bindKey: bindKey("Ctrl-Left", "Option-Left"), exec: function(env, args, request) { env.editor.navigateWordLeft(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selecttolinestart", bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"), exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotolinestart", bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), exec: function(env, args, request) { env.editor.navigateLineStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectleft", bindKey: bindKey("Shift-Left", "Shift-Left"), exec: function(env, args, request) { env.editor.getSelection().selectLeft(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotoleft", bindKey: bindKey("Left", "Left|Ctrl-B"), exec: function(env, args, request) { env.editor.navigateLeft(args.times); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectwordright", bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotowordright", bindKey: bindKey("Ctrl-Right", "Option-Right"), exec: function(env, args, request) { env.editor.navigateWordRight(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selecttolineend", bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"), exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotolineend", bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), exec: function(env, args, request) { env.editor.navigateLineEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectright", bindKey: bindKey("Shift-Right", "Shift-Right"), exec: function(env, args, request) { env.editor.getSelection().selectRight(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotoright", bindKey: bindKey("Right", "Right|Ctrl-F"), exec: function(env, args, request) { env.editor.navigateRight(args.times); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectpagedown", bindKey: bindKey("Shift-PageDown", "Shift-PageDown"), exec: function(env, args, request) { env.editor.selectPageDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "pagedown", bindKey: bindKey(null, "PageDown"), exec: function(env, args, request) { env.editor.scrollPageDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotopagedown", bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"), exec: function(env, args, request) { env.editor.gotoPageDown(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectpageup", bindKey: bindKey("Shift-PageUp", "Shift-PageUp"), exec: function(env, args, request) { env.editor.selectPageUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "pageup", bindKey: bindKey(null, "PageUp"), exec: function(env, args, request) { env.editor.scrollPageUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "gotopageup", bindKey: bindKey("PageUp", "Option-PageUp"), exec: function(env, args, request) { env.editor.gotoPageUp(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectlinestart", bindKey: bindKey("Shift-Home", "Shift-Home"), exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "selectlineend", bindKey: bindKey("Shift-End", "Shift-End"), exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "del", bindKey: bindKey("Delete", "Delete|Ctrl-D"), exec: function(env, args, request) { env.editor.removeRight(); } }); - canon.addCommand({ + gcli.addCommand({ name: "backspace", bindKey: bindKey( "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace", @@ -351,53 +351,53 @@ exports.startup = function() { ), exec: function(env, args, request) { env.editor.removeLeft(); } }); - canon.addCommand({ + gcli.addCommand({ name: "removetolinestart", bindKey: bindKey(null, "Option-Backspace"), exec: function(env, args, request) { env.editor.removeToLineStart(); } }); - canon.addCommand({ + gcli.addCommand({ name: "removetolineend", bindKey: bindKey(null, "Ctrl-K"), exec: function(env, args, request) { env.editor.removeToLineEnd(); } }); - canon.addCommand({ + gcli.addCommand({ name: "removewordleft", bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"), exec: function(env, args, request) { env.editor.removeWordLeft(); } }); - canon.addCommand({ + gcli.addCommand({ name: "removewordright", bindKey: bindKey(null, "Alt-Delete"), exec: function(env, args, request) { env.editor.removeWordRight(); } }); - canon.addCommand({ + gcli.addCommand({ name: "outdent", bindKey: bindKey("Shift-Tab", "Shift-Tab"), exec: function(env, args, request) { env.editor.blockOutdent(); } }); - canon.addCommand({ + gcli.addCommand({ name: "indent", bindKey: bindKey("Tab", "Tab"), exec: function(env, args, request) { env.editor.indent(); } }); - canon.addCommand({ + gcli.addCommand({ name: "inserttext", exec: function(env, args, request) { env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); } }); - canon.addCommand({ + gcli.addCommand({ name: "centerselection", bindKey: bindKey("Ctrl-L", "Ctrl-L"), exec: function(env, args, request) { env.editor.centerSelection(); } }); - canon.addCommand({ + gcli.addCommand({ name: "splitline", bindKey: bindKey(null, "Ctrl-O"), exec: function(env, args, request) { env.editor.splitLine(); } }); - canon.addCommand({ + gcli.addCommand({ name: "transposeletters", bindKey: bindKey("Ctrl-T", "Ctrl-T"), exec: function(env, args, request) { env.editor.transposeLetters(); } diff --git a/lib/ace/commands/settings.js b/lib/ace/commands/settings.js index 2e0247f2..b42530da 100644 --- a/lib/ace/commands/settings.js +++ b/lib/ace/commands/settings.js @@ -38,7 +38,7 @@ define(function(require, exports, module) { -var canon = require('cockpit/canon'); +var gcli = require('cockpit/index'); var pref = { metadata: { @@ -57,7 +57,7 @@ var pref = { ] }, show: function(filter) { - var names = canon.getEnvironment().settings.getSettingNames(); + var names = gcli.getEnvironment().settings.getSettingNames(); // first sort the settingsList based on the name names.sort(function(name1, name2) { return name1.localeCompare(name2); @@ -73,7 +73,7 @@ var pref = { return; } - var setting = canon.getEnvironment().settings.getSetting(name); + var setting = gcli.getEnvironment().settings.getSetting(name); var url = 'https://wiki.mozilla.org/Labs/Skywriter/Settings#' + setting.name; html += '