codemirror / CodeMirror-v1

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version
http://codemirror.net/
Other
362 stars 63 forks source link

Speed up hideLine method #60

Closed jurek7 closed 12 years ago

jurek7 commented 12 years ago

I use hideLine for code folding. When i fire this method first time in my editor(more than 100 lines to hide) it takes about 30 seconds. On next call it takes about 30 millis.

Maybe it would be better to write some method for hide range e.g hideLines(from, to)?

marijnh commented 12 years ago

Wrap your loop in a call to .operation. That way, the editor will not be forced to update itself after every call.

editor.operation(function() {
   for (...) editor.hideLine(i);
});