changes resulting from resource moves from pilot to cockpit

This commit is contained in:
Joe Walker 2011-03-30 09:19:03 +01:00
commit 953cc3b240
10 changed files with 388 additions and 395 deletions

View file

@ -35,7 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
/*
require({
paths: {
demo: "../demo",
@ -45,42 +44,41 @@ require({
}
});
var deps = [ "pilot/fixoldbrowsers", "ace/plugin_manager",
"ace/environment", "demo/demo" ];
//*
var deps = [
"pilot/fixoldbrowsers",
"ace/plugin_manager",
"ace/environment",
"demo/demo"
];
var plugins = [ "pilot/index", "cockpit/index", "ace/index" ];
require(deps, function() {
var catalog = require("ace/plugin_manager").catalog;
var plugins = [ "cockpit/index", "ace/index" ];
catalog.registerPlugins(plugins).then(function() {
var env = require("ace/environment").create();
catalog.startupPlugins({ env: env }).then(function() {
var gcli = require("cockpit/index");
new gcli.CliView(env);
require("demo/demo").launch(env);
});
});
});
*/
require({
paths: {
demo: "../demo",
ace: "../lib/ace",
cockpit: "../support/cockpit/lib/cockpit",
pilot: "../support/cockpit/support/pilot/lib/pilot"
}
});
//*/
/*
var deps = [
"ace/environment", "pilot/index", "cockpit/index", "ace/index",
"ace/environment", "cockpit/index", "ace/index", "demo/demo",
"pilot/fixoldbrowsers"
];
require(deps, function(environment, pilot, cockpit) {
require(deps, function(environment, cockpit, ace, demo) {
var data = { env: environment.create() };
pilot.startup(data);
cockpit.startup(data);
new cockpit.CliView(data.env);
require([ "demo/demo" ], function(demo) {
demo.launch(data.env);
});
ace.startup(data);
demo.launch(data.env);
}.bind(this));
//*/

View file

@ -40,7 +40,7 @@
define(function(require, exports, module) {
exports.launch = function(env) {
var canon = require("pilot/canon");
var canon = require("cockpit/canon");
var event = require("pilot/event");
var Editor = require("ace/editor").Editor;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;

View file

@ -41,7 +41,7 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var canon = require("pilot/canon");
var canon = require("cockpit/canon");
function bindKey(win, mac) {
return {
@ -51,352 +51,358 @@ function bindKey(win, mac) {
};
}
canon.addCommand({
name: "null",
exec: function(env, args, request) { }
});
/**
* TODO: This could be done more concisely and reversibly
*/
exports.startup = function() {
canon.addCommand({
name: "null",
exec: function(env, args, request) { }
});
canon.addCommand({
name: "selectall",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(env, args, request) { env.editor.selectAll(); }
});
canon.addCommand({
name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(env, args, request) { env.editor.removeLines(); }
});
canon.addCommand({
name: "gotoline",
description: "Move the cursor to the given line",
bindKey: bindKey("Ctrl-L", "Command-L"),
params: [
{ name: "line", type: "number", description: "The line number to jump to" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.line) {
while (!isNaN(args.line)) {
args.line = parseInt(prompt("Enter line number:"));
canon.addCommand({
name: "selectall",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(env, args, request) { env.editor.selectAll(); }
});
canon.addCommand({
name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(env, args, request) { env.editor.removeLines(); }
});
canon.addCommand({
name: "gotoline",
description: "Move the cursor to the given line",
bindKey: bindKey("Ctrl-L", "Command-L"),
params: [
{ name: "line", type: "number", description: "The line number to jump to" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.line) {
while (!isNaN(args.line)) {
args.line = parseInt(prompt("Enter line number:"));
}
}
env.editor.gotoLine(args.line);
}
env.editor.gotoLine(args.line);
}
});
canon.addCommand({
name: "togglecomment",
bindKey: bindKey("Ctrl-7", "Command-7"),
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
});
canon.addCommand({
name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(env, args, request) { env.editor.findNext(); }
});
canon.addCommand({
name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(env, args, request) { env.editor.findPrevious(); }
});
canon.addCommand({
name: "find",
description: "Search for the next instance of a string",
bindKey: bindKey("Ctrl-F", "Command-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
args.findWhat = prompt("Find:");
}
env.editor.find(args.findWhat);
}
});
canon.addCommand({
name: "replace",
description: "Replace the next instance of a string with a given replacement",
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" },
{ name: "replacement", type: "string", description: "The replacement text" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
args.findWhat = prompt("Find:");
});
canon.addCommand({
name: "togglecomment",
bindKey: bindKey("Ctrl-7", "Command-7"),
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
});
canon.addCommand({
name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(env, args, request) { env.editor.findNext(); }
});
canon.addCommand({
name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(env, args, request) { env.editor.findPrevious(); }
});
canon.addCommand({
name: "find",
description: "Search for the next instance of a string",
bindKey: bindKey("Ctrl-F", "Command-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
return;
}
args.replacement = prompt("Replacement:");
if (!args.replacement) {
return;
args.findWhat = prompt("Find:");
}
env.editor.find(args.findWhat);
}
env.editor.replace(args.replacement, {needle: args.findWhat});
}
});
canon.addCommand({
name: "replaceall",
description: "Replace all instances of a string with a given replacement",
bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" },
{ name: "replacement", type: "string", description: "The replacement text" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
args.findWhat = prompt("Find:");
});
canon.addCommand({
name: "replace",
description: "Replace the next instance of a string with a given replacement",
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" },
{ name: "replacement", type: "string", description: "The replacement text" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
return;
}
args.replacement = prompt("Replacement:");
if (!args.replacement) {
return;
args.findWhat = prompt("Find:");
if (!args.findWhat) {
return;
}
args.replacement = prompt("Replacement:");
if (!args.replacement) {
return;
}
}
env.editor.replace(args.replacement, {needle: args.findWhat});
}
env.editor.replaceAll(args.replacement, {needle: args.findWhat});
}
});
canon.addCommand({
name: "undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(env, args, request) { env.editor.undo(); }
});
canon.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({
name: "overwrite",
bindKey: bindKey("Insert", "Insert"),
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
});
canon.addCommand({
name: "copylinesup",
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
exec: function(env, args, request) { env.editor.copyLinesUp(); }
});
canon.addCommand({
name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(env, args, request) { env.editor.moveLinesUp(); }
});
canon.addCommand({
name: "selecttostart",
bindKey: bindKey("Alt-Shift-Up", "Command-Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
});
canon.addCommand({
name: "gotostart",
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
exec: function(env, args, request) { env.editor.navigateFileStart(); }
});
canon.addCommand({
name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
});
canon.addCommand({
name: "golineup",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
});
canon.addCommand({
name: "copylinesdown",
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
exec: function(env, args, request) { env.editor.copyLinesDown(); }
});
canon.addCommand({
name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(env, args, request) { env.editor.moveLinesDown(); }
});
canon.addCommand({
name: "selecttoend",
bindKey: bindKey("Alt-Shift-Down", "Command-Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
});
canon.addCommand({
name: "gotoend",
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
});
canon.addCommand({
name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
});
canon.addCommand({
name: "golinedown",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
});
canon.addCommand({
name: "selectwordleft",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
});
canon.addCommand({
name: "gotowordleft",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
});
canon.addCommand({
name: "selecttolinestart",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
});
canon.addCommand({
name: "gotolinestart",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(env, args, request) { env.editor.navigateLineStart(); }
});
canon.addCommand({
name: "selectleft",
bindKey: bindKey("Shift-Left", "Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
});
canon.addCommand({
name: "gotoleft",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
});
canon.addCommand({
name: "selectwordright",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
});
canon.addCommand({
name: "gotowordright",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(env, args, request) { env.editor.navigateWordRight(); }
});
canon.addCommand({
name: "selecttolineend",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
});
canon.addCommand({
name: "gotolineend",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
});
canon.addCommand({
name: "selectright",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
});
canon.addCommand({
name: "gotoright",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
});
canon.addCommand({
name: "selectpagedown",
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
exec: function(env, args, request) { env.editor.selectPageDown(); }
});
canon.addCommand({
name: "pagedown",
bindKey: bindKey(null, "PageDown"),
exec: function(env, args, request) { env.editor.scrollPageDown(); }
});
canon.addCommand({
name: "gotopagedown",
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
exec: function(env, args, request) { env.editor.gotoPageDown(); }
});
canon.addCommand({
name: "selectpageup",
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
exec: function(env, args, request) { env.editor.selectPageUp(); }
});
canon.addCommand({
name: "pageup",
bindKey: bindKey(null, "PageUp"),
exec: function(env, args, request) { env.editor.scrollPageUp(); }
});
canon.addCommand({
name: "gotopageup",
bindKey: bindKey("PageUp", "Option-PageUp"),
exec: function(env, args, request) { env.editor.gotoPageUp(); }
});
canon.addCommand({
name: "selectlinestart",
bindKey: bindKey("Shift-Home", "Shift-Home"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
});
canon.addCommand({
name: "selectlineend",
bindKey: bindKey("Shift-End", "Shift-End"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
});
canon.addCommand({
name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
exec: function(env, args, request) { env.editor.removeRight(); }
});
canon.addCommand({
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.removeLeft(); }
});
canon.addCommand({
name: "removetolinestart",
bindKey: bindKey(null, "Option-Backspace"),
exec: function(env, args, request) { env.editor.removeToLineStart(); }
});
canon.addCommand({
name: "removetolineend",
bindKey: bindKey(null, "Ctrl-K"),
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
});
canon.addCommand({
name: "removewordleft",
bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(env, args, request) { env.editor.removeWordLeft(); }
});
canon.addCommand({
name: "removewordright",
bindKey: bindKey(null, "Alt-Delete"),
exec: function(env, args, request) { env.editor.removeWordRight(); }
});
canon.addCommand({
name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(env, args, request) { env.editor.blockOutdent(); }
});
canon.addCommand({
name: "indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(env, args, request) { env.editor.indent(); }
});
canon.addCommand({
name: "inserttext",
exec: function(env, args, request) {
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
}
});
canon.addCommand({
name: "centerselection",
bindKey: bindKey("Ctrl-L", "Ctrl-L"),
exec: function(env, args, request) { env.editor.centerSelection(); }
});
canon.addCommand({
name: "splitline",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(env, args, request) { env.editor.splitLine(); }
});
canon.addCommand({
name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(env, args, request) { env.editor.transposeLetters(); }
});
});
canon.addCommand({
name: "replaceall",
description: "Replace all instances of a string with a given replacement",
bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
params: [
{ name: "findWhat", type: "string", description: "The text to search for" },
{ name: "replacement", type: "string", description: "The replacement text" }
],
exec: function(env, args, request) {
// TODO: manual params should not be needed
if (!args.findWhat) {
args.findWhat = prompt("Find:");
if (!args.findWhat) {
return;
}
args.replacement = prompt("Replacement:");
if (!args.replacement) {
return;
}
}
env.editor.replaceAll(args.replacement, {needle: args.findWhat});
}
});
canon.addCommand({
name: "undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(env, args, request) { env.editor.undo(); }
});
canon.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({
name: "overwrite",
bindKey: bindKey("Insert", "Insert"),
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
});
canon.addCommand({
name: "copylinesup",
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
exec: function(env, args, request) { env.editor.copyLinesUp(); }
});
canon.addCommand({
name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(env, args, request) { env.editor.moveLinesUp(); }
});
canon.addCommand({
name: "selecttostart",
bindKey: bindKey("Alt-Shift-Up", "Command-Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
});
canon.addCommand({
name: "gotostart",
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
exec: function(env, args, request) { env.editor.navigateFileStart(); }
});
canon.addCommand({
name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up"),
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
});
canon.addCommand({
name: "golineup",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
});
canon.addCommand({
name: "copylinesdown",
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
exec: function(env, args, request) { env.editor.copyLinesDown(); }
});
canon.addCommand({
name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(env, args, request) { env.editor.moveLinesDown(); }
});
canon.addCommand({
name: "selecttoend",
bindKey: bindKey("Alt-Shift-Down", "Command-Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
});
canon.addCommand({
name: "gotoend",
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
});
canon.addCommand({
name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down"),
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
});
canon.addCommand({
name: "golinedown",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
});
canon.addCommand({
name: "selectwordleft",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
});
canon.addCommand({
name: "gotowordleft",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
});
canon.addCommand({
name: "selecttolinestart",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
});
canon.addCommand({
name: "gotolinestart",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(env, args, request) { env.editor.navigateLineStart(); }
});
canon.addCommand({
name: "selectleft",
bindKey: bindKey("Shift-Left", "Shift-Left"),
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
});
canon.addCommand({
name: "gotoleft",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
});
canon.addCommand({
name: "selectwordright",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
});
canon.addCommand({
name: "gotowordright",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(env, args, request) { env.editor.navigateWordRight(); }
});
canon.addCommand({
name: "selecttolineend",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
});
canon.addCommand({
name: "gotolineend",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
});
canon.addCommand({
name: "selectright",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
});
canon.addCommand({
name: "gotoright",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
});
canon.addCommand({
name: "selectpagedown",
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
exec: function(env, args, request) { env.editor.selectPageDown(); }
});
canon.addCommand({
name: "pagedown",
bindKey: bindKey(null, "PageDown"),
exec: function(env, args, request) { env.editor.scrollPageDown(); }
});
canon.addCommand({
name: "gotopagedown",
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
exec: function(env, args, request) { env.editor.gotoPageDown(); }
});
canon.addCommand({
name: "selectpageup",
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
exec: function(env, args, request) { env.editor.selectPageUp(); }
});
canon.addCommand({
name: "pageup",
bindKey: bindKey(null, "PageUp"),
exec: function(env, args, request) { env.editor.scrollPageUp(); }
});
canon.addCommand({
name: "gotopageup",
bindKey: bindKey("PageUp", "Option-PageUp"),
exec: function(env, args, request) { env.editor.gotoPageUp(); }
});
canon.addCommand({
name: "selectlinestart",
bindKey: bindKey("Shift-Home", "Shift-Home"),
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
});
canon.addCommand({
name: "selectlineend",
bindKey: bindKey("Shift-End", "Shift-End"),
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
});
canon.addCommand({
name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
exec: function(env, args, request) { env.editor.removeRight(); }
});
canon.addCommand({
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.removeLeft(); }
});
canon.addCommand({
name: "removetolinestart",
bindKey: bindKey(null, "Option-Backspace"),
exec: function(env, args, request) { env.editor.removeToLineStart(); }
});
canon.addCommand({
name: "removetolineend",
bindKey: bindKey(null, "Ctrl-K"),
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
});
canon.addCommand({
name: "removewordleft",
bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(env, args, request) { env.editor.removeWordLeft(); }
});
canon.addCommand({
name: "removewordright",
bindKey: bindKey(null, "Alt-Delete"),
exec: function(env, args, request) { env.editor.removeWordRight(); }
});
canon.addCommand({
name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(env, args, request) { env.editor.blockOutdent(); }
});
canon.addCommand({
name: "indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(env, args, request) { env.editor.indent(); }
});
canon.addCommand({
name: "inserttext",
exec: function(env, args, request) {
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
}
});
canon.addCommand({
name: "centerselection",
bindKey: bindKey("Ctrl-L", "Ctrl-L"),
exec: function(env, args, request) { env.editor.centerSelection(); }
});
canon.addCommand({
name: "splitline",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(env, args, request) { env.editor.splitLine(); }
});
canon.addCommand({
name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(env, args, request) { env.editor.transposeLetters(); }
});
};
});

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var canon = require('pilot/canon');
var canon = require('cockpit/canon');
var pref = {
metadata: {

View file

@ -37,11 +37,14 @@
define(function(require, exports, module) {
var settings = require("ace/settings").settings;
/**
* Create an environment object
*/
* Create an environment object
*/
function create() {
return {
settings: settings
};
};

View file

@ -40,7 +40,7 @@ define(function(require, exports, module) {
var useragent = require("pilot/useragent");
var event = require("pilot/event");
var canon = require("pilot/canon");
var canon = require("cockpit/canon");
var keyUtil = require("ace/keys");
var settings = require("ace/settings").settings;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var Promise = require("pilot/promise").Promise;
var Promise = require("ace/promise").Promise;
exports.REASONS = {
APP_STARTUP: 1,

View file

@ -44,12 +44,12 @@ define(function(require, exports, module) {
var console = require('pilot/console');
var oop = require('pilot/oop');
var types = require('pilot/types');
var types = require('cockpit/types');
var EventEmitter = require('pilot/event_emitter').EventEmitter;
var SelectionType = require('pilot/types/basic').SelectionType;
var DeferredType = require('pilot/types/basic').DeferredType;
var Argument = require('pilot/argument').Argument;
var SelectionType = require('cockpit/basic').SelectionType;
var DeferredType = require('cockpit/basic').DeferredType;
var Argument = require('cockpit/argument').Argument;
/**
@ -314,7 +314,7 @@ exports.CookiePersister = CookiePersister;
/**
* EVIL: This relies on us using settingValue in the same event as setting
* This relies on us using settingValue in the same event as setting
* The alternative is to have some central place where we store the current
* command line, but this might be a lesser evil for now.
*/
@ -330,22 +330,17 @@ var setting = new SelectionType({
},
noMatch: function() {
lastSetting = null;
}
});
(function() {
var originalStringify = setting.stringify;
setting.stringify = function(setting) {
},
stringify: function(setting) {
lastSetting = setting;
return originalStringify.call(this, setting);
};
var originalParse = setting.parse;
setting.parse = function(arg) {
var conversion = originalParse.call(this, arg);
return SelectionType.prototype.stringify.call(this, setting);
},
parse: function(arg) {
var conversion = SelectionType.prototype.parse.call(this, arg);
lastSetting = conversion.value;
return conversion;
};
})();
}
});
/**
* Something of a hack to allow the set command to give a clearer definition

View file

@ -38,17 +38,9 @@
define(function(require, exports, module) {
var types = require('pilot/types');
var SelectionType = require('pilot/types/basic').SelectionType;
var env;
var settingTypes = {
selectionStyle: new SelectionType({
data: [ 'line', 'text' ]
})
};
var settings = {
printMargin: {
description: 'Position of the print margin column.',
@ -76,7 +68,7 @@ var settings = {
},
selectionStyle: {
description: 'Type of text selection.',
type: 'selectionStyle',
type: { name: 'selection', data: [ 'line', 'text' ] },
defaultValue: 'line',
onChange: function onChange(event) {
if (env.editor) env.editor.setSelectionStyle(event.value);
@ -86,7 +78,6 @@ var settings = {
exports.startup = function startup(data) {
env = data.env;
types.registerTypes(settingTypes);
data.env.settings.addSettings(settings);
};

@ -1 +1 @@
Subproject commit e20180cc3311b0d366e2624ddd1b150767bb41e4
Subproject commit ebd56b41a28bb28805ae92b3d2356fdbed3a49c9