Search code examples
javascriptcloud9-ideace-editor

How do I make Ace editor resize its height accordingly to the number of rows?


What do I do to configure Ace to have its height so that all lines will be always visible, rather than having a vertical scrollbar?

Basically, the equivalent of:

document.querySelector("textarea").oninput = function(){
    this.rows = this.value.split(/\n/g).length;
};

http://jsfiddle.net/obobjrf5/

How do I do that? Thank you in advance.


Solution

  • Use maxLines option editor.setOption("maxLines", 1000).