BlockIndent command ( Ctrl-[ and Ctrl-] )

This commit is contained in:
DanyaPostfactum 2013-01-24 19:22:30 +10:00 committed by nightwing
commit 3952ef9afd
2 changed files with 22 additions and 3 deletions

View file

@ -414,6 +414,16 @@ exports.commands = [{
bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach"
},{
name: "blockoutdent",
bindKey: bindKey("Ctrl-[", "Ctrl-["),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEach"
},{
name: "blockindent",
bindKey: bindKey("Ctrl-]", "Ctrl-]"),
exec: function(editor) { editor.blockIndent(); },
multiSelectAction: "forEach"
}, {
name: "insertstring",
exec: function(editor, str) { editor.insert(str); },

View file

@ -1245,8 +1245,8 @@ var Editor = function(renderer, session) {
this.selection.setSelectionRange(originalRange);
};
/**
* Indents the current line.
/**
* Inserts an indentation into the current cursor position or indents the selected lines.
*
* @related EditSession.indentRows
**/
@ -1273,7 +1273,16 @@ var Editor = function(renderer, session) {
}
};
/**
/**
* Indents the current line.
* @related EditSession.indentRows
**/
this.blockIndent = function() {
var rows = this.$getSelectedRows();
this.session.indentRows(rows.first, rows.last, "\t");
};
/**
* Outdents the current line.
* @related EditSession.outdentRows
**/