Merge remote branch 'jviereck/kb'

Conflicts:
	lib/ace/keyboard/keybinding/default_mac.js
	lib/ace/keyboard/keybinding/default_win.js
	support/pilot
This commit is contained in:
Fabian Jakobs 2011-03-07 20:00:51 +01:00
commit 0a00b8aea6
7 changed files with 149 additions and 215 deletions

View file

@ -40,7 +40,7 @@
define(function(require, exports, module) {
exports.launch = function(env) {
var canon = require("pilot/canon");
var event = require("pilot/event");
var Editor = require("ace/editor").Editor;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
@ -383,6 +383,68 @@ exports.launch = function(env) {
});
window.env = env;
/**
* This demonstrates how you can define commands and bind shortcuts to them.
*/
// Command to focus the command line from the editor.
canon.addCommand({
name: "focuscli",
bindKey: {
win: "Ctrl-J",
mac: "Command-J",
sender: "editor"
},
exec: function() {
env.cli.cliView.element.focus();
}
});
// Command to focus the editor line from the command line.
canon.addCommand({
name: "focuseditor",
bindKey: {
win: "Ctrl-J",
mac: "Command-J",
sender: "cli"
},
exec: function() {
env.editor.focus();
}
});
// Fake-Save, works from the editor and the command line.
canon.addCommand({
name: "save",
bindKey: {
win: "Ctrl-S",
mac: "Command-S",
sender: "editor|cli"
},
exec: function() {
alert("Fake Save File");
}
});
// Fake-Print with custom lookup-sender-match function.
canon.addCommand({
name: "save",
bindKey: {
win: "Ctrl-P",
mac: "Command-P",
sender: function(env, sender, hashId, keyString) {
if (sender == "editor") {
return true;
} else {
alert("Sorry, can only print from the editor");
}
}
},
exec: function() {
alert("Fake Print File");
}
});
};
});