Merge branch 'master' of github.com:ajaxorg/ace

This commit is contained in:
Fabian Jakobs 2011-11-02 13:15:17 +01:00
commit 22274e4d4c
24 changed files with 337 additions and 186 deletions

View file

@ -11860,9 +11860,26 @@ var Selection = function(session) {
this.selectionLead.row,
this.selectionLead.column
);
var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
var screenCol = (chars === 0 && this.$desiredColumn) || screenPos.column;
// so here is the deal. First checkout what the content of ur current and ur target line is
var currentLine = (this.session.getLines(screenPos.row, screenPos.row) || [""])[0],
targetLine = (this.session.getLines(screenPos.row + rows, screenPos.row + rows) || [""])[0];
// if you are at the EOL of your current line, and your targetline is all whitespace
if (currentLine && targetLine &&
currentLine.length === screenPos.column && targetLine.match(/^\s*$/)) {
// set the new column to the EOL of the target line
screenCol = this.session.getTabString(targetLine).length;
// update the chars so we are sure that the desired column will be updated
chars = 1;
};
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
// move the cursor and update the desired column
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
};
this.moveCursorToPosition = function(position) {