do not require cursors to be sorted

This commit is contained in:
nightwing 2012-03-20 00:02:24 +04:00
commit 107735560a

View file

@ -141,37 +141,33 @@ var Cursor = function(parentEl) {
this.update = function(config) {
this.config = config;
if (!this.session.selection.multiSelectMode) {
this.pixelPos = this.getPixelPosition(null, true);
if (this.session.selection.rangeCount > 1) {
var selections = this.session.selection.allRanges
var i = 0, sel, cursorIndex = 0;
for (var i = selections.length; i--; ) {
sel = selections[i];
var pixelPos = this.getPixelPosition(sel.cursor, true);
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
style.left = pixelPos.left + "px";
style.top = pixelPos.top + "px";
style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px";
}
while (cursorIndex < this.cursors.length)
this.removeCursor();
} else {
var pixelPos = this.getPixelPosition(null, true);
var style = this.cursor.style;
style.left = this.pixelPos.left + "px";
style.top = this.pixelPos.top + "px";
style.left = pixelPos.left + "px";
style.top = pixelPos.top + "px";
style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px";
while (this.cursors.length > 1)
this.removeCursor();
} else {
var selections = this.session.selection.allRanges
var i = 0, sel, cursorIndex = 0;
while ((sel = selections[i]) && sel.cursor.row < config.firstRow)
i++;
while ((sel = selections[i]) && sel.cursor.row < config.lastRow) {
this.pixelPos = this.getPixelPosition(sel.cursor, true);
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
style.left = this.pixelPos.left + "px";
style.top = this.pixelPos.top + "px";
style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px";
i++;
}
while (cursorIndex < this.cursors.length)
this.removeCursor();
}
var overwrite = this.session.getOverwrite();