removeLines in ace ajax #159

dudiq opened this Issue Jan 17, 2013 · 6 comments


None yet

5 participants


open in two tabs this link

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.


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


I can't confirm that @ggoodman.

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