removeLines in ace ajax #159

Open
dudiq opened this Issue Jan 17, 2013 · 6 comments

Projects

None yet

5 participants

@dudiq

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.

@ggoodman

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

@wmertens

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

@nightwing

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.

@wmertens
@ggoodman

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

@luto

I can't confirm that @ggoodman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment