Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Lines number after setText ('change' event) is broken #1356

tucnak opened this Issue · 3 comments

2 participants


If I call


Also, I have a handler:

editor.on('change', function() {
    var newLines = editor.session.getLength();
    if (newLines != property("lines")) { // property is a storage function
        property("lines", newLines);

Application's debug output:

[1] Lines number: 2. Text is "'use strict';
[2] Lines number: 1047. Text is "'use strict';


 * @ngdoc function


after one setText call and code listed below. So, 'change' event is called twice (no idea why) and shows 2 lines always ('use strict' + \n) before real number of lines in the document


Change event is dispatched synchronously during each part operation, setValue creates multiple change events one for removing old text and one for inserting.
Operations inserting multiple lines also will create several change events


@nightwing How can I handle visual changes, like changing the text or # of lines?


It depends on what exactly you need, but setTimeout can work see

@tucnak tucnak closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.