skip history when calling `setValue()`

Hi,

I wonder if it’s possible to update a CodeMirror’s value without adding an entry to its history value. I have a CodeMirror that is read-only and whose value is only ever updated from JavaScript.
Of course, I can call clearHistory() directly after setValue() but it would probably be better not to have a history entry created in the first place.
I could also set the history size to 0, but AFAIK that’s not possible.

Cheers,
Jochen

What concrete problem are you trying to solve? Are you worried about the history data taking up memory? Setting undoDepth to zero should work. As does calling clearHistory().

Thanks for your help.

Are you worried about the history data taking up memory?

Yes, I have multiple CodeMirror instances and the content can get quite large (100k lines+). Each update needs about 12 MB of memory.

Setting undoDepth to zero should work. As does calling clearHistory().

I hadn’t noticed undoDepth in the docs, thanks! Calling clearHistory() is what I do now, but that creates a history entry anyway, if only for a short time. And from reading the code, I understand that undoDepth works like that too.