Merge branch 'emacs-mode'

This commit is contained in:
Chester Wood 2013-01-26 14:52:37 -07:00 • committed by nightwing
commit db34cf6a20

View file

@ -66,8 +66,6 @@ exports.handler.attach = function(editor) {
if (!initialized) { if (!initialized) {
initialized = true; initialized = true;
// in emacs, gotowordleft/right should not count a space as a word..
editor.session.$selectLongWords = true;
dom.importCssString('\ dom.importCssString('\
.emacs-mode .ace_cursor{\ .emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\ border: 2px rgba(50,250,50,0.8) solid!important;\
@ -94,12 +92,21 @@ exports.handler.attach = function(editor) {
}', 'emacsMode' }', 'emacsMode'
); );
} }
// in emacs, gotowordleft/right should not count a space as a word..
editor.session.$selectLongWords = true;
markMode = false; markMode = false;
editor.on("click",$resetMarkMode); editor.on("click",$resetMarkMode);
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates; editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
// kitchen sink seems to reload the session after loading the kb handler.
editor.on("changeSession",function(e) {
e.session.$selectLongWords = true;
});
editor.setStyle("emacs-mode"); editor.setStyle("emacs-mode");
}; };
exports.handler.detach = function(editor) { exports.handler.detach = function(editor) {
@ -323,7 +330,7 @@ exports.handler.addCommands({
selectRectangularRegion: function(editor) { selectRectangularRegion: function(editor) {
editor.multiSelect.toggleBlockSelection(); editor.multiSelect.toggleBlockSelection();
}, },
setMark: function() { setMark: function(editor) {
// Sets mark-mode and clears current selection. // Sets mark-mode and clears current selection.
// When in mark-mode, "goto" commands become "select" commands. // When in mark-mode, "goto" commands become "select" commands.
// Any insertion or mouse click resets mark-mode. // Any insertion or mouse click resets mark-mode.
@ -374,9 +381,10 @@ exports.handler.addCommands({
}, },
killLine: function(editor) { killLine: function(editor) {
markMode = null; markMode = null;
var pos = editor.getCursorPosition();
if (editor.getCursorPosition().column == 0 && if (pos.column == 0 &&
editor.selection.isEmpty) { editor.session.doc.getLine(pos.row).length == 0) {
// If an already empty line is killed, remove // If an already empty line is killed, remove
// the line entirely // the line entirely
editor.selection.selectLine(); editor.selection.selectLine();