go up on fist line should not reset the desired column
This commit is contained in:
parent
b6223bc801
commit
628c0d6414
2 changed files with 12 additions and 3 deletions
|
|
@ -56,8 +56,6 @@ var Selection = function(session) {
|
||||||
_self._dispatchEvent("changeCursor");
|
_self._dispatchEvent("changeCursor");
|
||||||
if (!_self.$isEmpty)
|
if (!_self.$isEmpty)
|
||||||
_self._dispatchEvent("changeSelection");
|
_self._dispatchEvent("changeSelection");
|
||||||
if (e.old.row == e.value.row)
|
|
||||||
_self.$updateDesiredColumn();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectionAnchor.on("change", function() {
|
this.selectionAnchor.on("change", function() {
|
||||||
|
|
@ -435,7 +433,6 @@ var Selection = function(session) {
|
||||||
);
|
);
|
||||||
var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
|
var screenCol = (chars == 0 && this.$desiredColumn) || screenPos.column;
|
||||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenCol);
|
||||||
|
|
||||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
this.moveCursorTo(docPos.row, docPos.column + chars, chars == 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,18 @@ module.exports = {
|
||||||
selection.moveCursorDown();
|
selection.moveCursorDown();
|
||||||
|
|
||||||
assert.position(selection.getCursor(), 0, 12);
|
assert.position(selection.getCursor(), 0, 12);
|
||||||
|
},
|
||||||
|
|
||||||
|
"test go line up twice and then once down when in the second should go back to the previous column": function() {
|
||||||
|
var session = new EditSession("juhu\nkinners");
|
||||||
|
var selection = session.getSelection();
|
||||||
|
|
||||||
|
selection.moveCursorTo(1, 4);
|
||||||
|
selection.moveCursorUp();
|
||||||
|
selection.moveCursorUp();
|
||||||
|
selection.moveCursorDown();
|
||||||
|
|
||||||
|
assert.position(selection.getCursor(), 1, 4);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue