Fix bug in Selection.moveCursorBy. Use desiredColumn only if chars == 0.
This commit is contained in:
parent
0ca8d22c7f
commit
a71f50ac9a
1 changed files with 11 additions and 7 deletions
|
|
@ -390,15 +390,19 @@ var Selection = function(doc) {
|
|||
|
||||
this.moveCursorBy = function(rows, chars) {
|
||||
if (this.doc.getUseWrapMode()) {
|
||||
var pos = this.doc.documentToScreenPosition(
|
||||
var screenPos = this.doc.documentToScreenPosition(
|
||||
this.selectionLead.row, this.selectionLead.column);
|
||||
pos = this.doc.screenToDocumentPosition(
|
||||
pos.row + rows, (this.$desiredColumn || pos.column));
|
||||
this.moveCursorTo(pos.row, pos.column + chars, chars == 0);
|
||||
var screenCol =
|
||||
(chars == 0 && this.$desiredColumn) || screenPos.column;
|
||||
|
||||
var docPos = this.doc.screenToDocumentPosition(
|
||||
screenPos.row + rows, screenCol);
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
||||
} else {
|
||||
this.moveCursorTo(this.selectionLead.row + rows,
|
||||
(this.$desiredColumn || this.selectionLead.column) + chars,
|
||||
chars == 0);
|
||||
var docColumn =
|
||||
(chars == 0 && this.$desiredColumn) || this.selectionLead.column;
|
||||
this.moveCursorTo(
|
||||
this.selectionLead.row + rows, docColumn + chars, chars == 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue