better handling of multiple cursors

This commit is contained in:
nightwing 2012-03-22 19:38:31 +04:00
commit 580ed00afa

View file

@ -142,7 +142,7 @@ var Cursor = function(parentEl) {
this.config = config; this.config = config;
if (this.session.selection.rangeCount > 1) { if (this.session.selection.rangeCount > 1) {
var selections = this.session.selection.allRanges var selections = this.session.selection.getAllRanges();
var i = 0, sel, cursorIndex = 0; var i = 0, sel, cursorIndex = 0;
for (var i = selections.length; i--; ) { for (var i = selections.length; i--; ) {
@ -156,6 +156,7 @@ var Cursor = function(parentEl) {
style.width = config.characterWidth + "px"; style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px"; style.height = config.lineHeight + "px";
} }
if (this.cursors.length > 1)
while (cursorIndex < this.cursors.length) while (cursorIndex < this.cursors.length)
this.removeCursor(); this.removeCursor();
} else { } else {