fix desired column computation

This commit is contained in:
Fabian Jakobs 2011-02-12 13:13:35 +01:00
commit 32a332fd3f
2 changed files with 13 additions and 5 deletions

View file

@ -53,10 +53,12 @@ var Selection = function(session) {
this.selectionAnchor = new Anchor(this.doc, 0, 0);
var _self = this;
this.selectionLead.on("change", function() {
this.selectionLead.on("change", function(e) {
_self._dispatchEvent("changeCursor");
if (!_self.$isEmpty)
_self._dispatchEvent("changeSelection");
if (e.old.row == e.value.row)
_self.$updateDesiredColumn();
});
this.selectionAnchor.on("change", function() {
@ -176,9 +178,7 @@ var Selection = function(session) {
this.$updateDesiredColumn = function() {
var cursor = this.getCursor();
if (cursor) {
this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
}
this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
};
this.$moveSelection = function(mover) {