Thank you for your help :-)
So what I want is to synchronize cursors between multiple collaborators. For each collaborator I do something like this
var lang = ace.require("ace/lib/lang")
this.syncCursor = lang.delayedCall(this._changeCursor)
var self = this;
this._editor().document.getSelection().on("changeCursor", function(){
self.syncCursor.delay(50);
});
the changeCursor function looks like this:
_changeCursor: function () {
var selection = this._editor().document.getSelection();
var cursors = [];
if (selection.inMultiSelectMode) {
cursors = selection.getAllRanges().map(function(range){return range.cursor;})
} else {
cursors.push(selection.getCursor())
}
//share cursors with the rest goes here....
}
My main problem is that the' changeCursor' doesn't fire on multiselect when the user is typing. One solution I have found is to add a document 'change' event and do this inside the handler function for the 'change' event.
if ( this._editor().document.multiSelect.inMultiSelectMode){
this.syncCursor.delay(10);
}
But it seems better if I could just do it with a 'changeCursor' event
Thanx again!