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"), bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); }, exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach" 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", name: "insertstring",
exec: function(editor, str) { editor.insert(str); }, exec: function(editor, str) { editor.insert(str); },

View file

@ -1246,7 +1246,7 @@ var Editor = function(renderer, session) {
}; };
/** /**
* Indents the current line. * Inserts an indentation into the current cursor position or indents the selected lines.
* *
* @related EditSession.indentRows * @related EditSession.indentRows
**/ **/
@ -1273,6 +1273,15 @@ 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. * Outdents the current line.
* @related EditSession.outdentRows * @related EditSession.outdentRows