rename group to aceCommandGroup to not conflict with cloud9

This commit is contained in:
nightwing 2013-11-24 16:13:36 +04:00
commit 9002950bf7
2 changed files with 25 additions and 25 deletions

View file

@ -165,14 +165,14 @@ exports.commands = [{
exec: function(editor) { editor.getSelection().selectFileStart(); }, exec: function(editor) { editor.getSelection().selectFileStart(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true, readOnly: true,
group: "fileJump" aceCommandGroup: "fileJump"
}, { }, {
name: "gotostart", name: "gotostart",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); }, exec: function(editor) { editor.navigateFileStart(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true, readOnly: true,
group: "fileJump" aceCommandGroup: "fileJump"
}, { }, {
name: "selectup", name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up"), bindKey: bindKey("Shift-Up", "Shift-Up"),
@ -191,14 +191,14 @@ exports.commands = [{
exec: function(editor) { editor.getSelection().selectFileEnd(); }, exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true, readOnly: true,
group: "fileJump" aceCommandGroup: "fileJump"
}, { }, {
name: "gotoend", name: "gotoend",
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); }, exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true, readOnly: true,
group: "fileJump" aceCommandGroup: "fileJump"
}, { }, {
name: "selectdown", name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down"), bindKey: bindKey("Shift-Down", "Shift-Down"),

View file

@ -110,17 +110,17 @@ var Editor = function(renderer, session) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
this.$initOperationListeners = function() { this.$initOperationListeners = function() {
function last(a) {return a[a.length - 1]}; function last(a) {return a[a.length - 1]}
this.selections = []; this.selections = [];
this.commands.on("exec", function(e) { this.commands.on("exec", function(e) {
this.startOperation(e); this.startOperation(e);
var command = e.command; var command = e.command;
if (command.group == "fileJump") { if (command.aceCommandGroup == "fileJump") {
var prev = this.prevOp; var prev = this.prevOp;
if (!prev || prev.command.group != "fileJump") { if (!prev || prev.command.aceCommandGroup != "fileJump") {
this.lastFileJumpPos = last(this.selections) this.lastFileJumpPos = last(this.selections);
} }
} else { } else {
this.lastFileJumpPos = null; this.lastFileJumpPos = null;
@ -130,10 +130,10 @@ var Editor = function(renderer, session) {
this.commands.on("afterExec", function(e) { this.commands.on("afterExec", function(e) {
var command = e.command; var command = e.command;
if (command.group == "fileJump") { if (command.aceCommandGroup == "fileJump") {
if (this.lastFileJumpPos && !this.curOp.selectionChanged) { if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
this.selection.fromJSON(this.lastFileJumpPos); this.selection.fromJSON(this.lastFileJumpPos);
return return;
} }
} }
this.endOperation(e); this.endOperation(e);
@ -150,7 +150,7 @@ var Editor = function(renderer, session) {
this.curOp || this.startOperation(); this.curOp || this.startOperation();
this.curOp.selectionChanged = true; this.curOp.selectionChanged = true;
}.bind(this), true); }.bind(this), true);
} };
this.curOp = null; this.curOp = null;
this.prevOp = {}; this.prevOp = {};
@ -218,12 +218,12 @@ var Editor = function(renderer, session) {
shouldMerge = shouldMerge shouldMerge = shouldMerge
&& this.mergeNextCommand // previous command allows to coalesce with && this.mergeNextCommand // previous command allows to coalesce with
&& (!/\s/.test(text) || /\s/.test(prev.args)) // previous insertion was of same type && (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
this.mergeNextCommand = true; this.mergeNextCommand = true;
} else { } else {
shouldMerge = shouldMerge shouldMerge = shouldMerge
&& mergeableCommands.indexOf(e.command.name) !== -1// the command is mergeable && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
} }
if ( if (
@ -689,7 +689,7 @@ var Editor = function(renderer, session) {
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
} }
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
this.session.highlight(re); this.session.highlight(re);
this._emit("changeSelection"); this._emit("changeSelection");
@ -1205,9 +1205,9 @@ var Editor = function(renderer, session) {
if (range.end.column == 0) { if (range.end.column == 0) {
var text = session.getTextRange(range); var text = session.getTextRange(range);
if (text[text.length - 1] == "\n") { if (text[text.length - 1] == "\n") {
var line = session.getLine(range.end.row) var line = session.getLine(range.end.row);
if (/^\s+$/.test(line)) { if (/^\s+$/.test(line)) {
range.end.column = line.length range.end.column = line.length;
} }
} }
} }
@ -1353,7 +1353,7 @@ var Editor = function(renderer, session) {
session.indentRows(rows.first, rows.last, "\t"); session.indentRows(rows.first, rows.last, "\t");
return; return;
} else if (range.start.column < range.end.column) { } else if (range.start.column < range.end.column) {
var text = session.getTextRange(range) var text = session.getTextRange(range);
if (!/^\s+$/.test(text)) { if (!/^\s+$/.test(text)) {
var rows = this.$getSelectedRows(); var rows = this.$getSelectedRows();
session.indentRows(rows.first, rows.last, "\t"); session.indentRows(rows.first, rows.last, "\t");
@ -1445,18 +1445,18 @@ var Editor = function(renderer, session) {
* @returns {Number} * @returns {Number}
**/ **/
this.getNumberAt = function(row, column) { this.getNumberAt = function(row, column) {
var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
_numberRx.lastIndex = 0 _numberRx.lastIndex = 0;
var s = this.session.getLine(row) var s = this.session.getLine(row);
while (_numberRx.lastIndex < column) { while (_numberRx.lastIndex < column) {
var m = _numberRx.exec(s) var m = _numberRx.exec(s);
if(m.index <= column && m.index+m[0].length >= column){ if(m.index <= column && m.index+m[0].length >= column){
var number = { var number = {
value: m[0], value: m[0],
start: m.index, start: m.index,
end: m.index+m[0].length end: m.index+m[0].length
} };
return number; return number;
} }
} }
@ -1542,7 +1542,7 @@ var Editor = function(renderer, session) {
range.start = point; range.start = point;
range.end = endPoint; range.end = endPoint;
sel.setSelectionRange(range, reverse) sel.setSelectionRange(range, reverse);
} }
}; };
@ -1827,7 +1827,7 @@ var Editor = function(renderer, session) {
var pos = { var pos = {
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2), row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2) column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
} };
this.renderer.alignCursor(pos, 0.5); this.renderer.alignCursor(pos, 0.5);
}; };