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

View file

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