josephg / ShareJS

Collaborative editing in any app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

removeLines in ace ajax

dudiq opened this issue · comments

open in two tabs this link
http://sharejs.org/hello-ace.html

open console in any tab and type:

var doc = editor.getSession().getDocument()
var lastRowIndex = doc.getAllLines().length - 1;
doc.removeLines(lastRowIndex, lastRowIndex);

console have errors.

the problem happens when remove only last line.

I recently noticed this.It is an issue with newer versions of ACE.

In the Document's change event, line removal operations are arriving in reverse order for multi-line deletions where either the start or endpoint of the deletion is not at the beginning/end of the line.

See ajaxorg/ace#1211

So we don't really know how this is caused?

Turns out, this is actually bug in ace. removeLines assumes that it's second argument is smaller than doc.getLength() - 1 and emits event with wrong range when it's arguments are wrong.

So Share is sending the wrong range or we need to update the bundled ACE?

Wout.

On Jan 23, 2013, at 18:09 , Harutyun Amirjanyan notifications@github.com wrote:

Turns out, this is actually bug in ace. removeLines assumes that it's second argument is smaller than doc.getLength() - 1 and emits event with wrong range when it's arguments are wrong.


Reply to this email directly or view it on GitHub.

In my app, I am using the latest build from ajaxorg/ace-builds and no longer have this bug.

commented

I can't confirm that @ggoodman.