fix selection handling in undo/redoChanges

This commit is contained in:
nightwing 2011-01-29 19:35:36 +08:00 committed by Fabian Jakobs
commit 31695f06c0

View file

@ -541,7 +541,7 @@ var EditSession = function(text, mode) {
if (firstDelta.action == "insertText" || firstDelta.action == "insertLines")
this.selection.moveCursorToPosition(firstDelta.range.start);
if (firstDelta.action == "removeText" || firstDelta.action == "removeLines")
this.selection.setSelectionRange(Range.fromPoints(firstDelta.range.start, lastDelta.range.end));
this.selection.setSelectionRange(Range.fromPoints(lastDelta.range.start, firstDelta.range.end));
},
this.redoChanges = function(deltas) {
@ -560,7 +560,7 @@ var EditSession = function(text, mode) {
if (firstDelta.action == "insertText" || firstDelta.action == "insertLines")
this.selection.setSelectionRange(Range.fromPoints(firstDelta.range.start, lastDelta.range.end));
if (firstDelta.action == "removeText" || firstDelta.action == "removeLines")
this.selection.moveCursorToPosition(firstDelta.range.start);
this.selection.moveCursorToPosition(lastDelta.range.start);
},
this.replace = function(range, text) {