Part of text not rendered

I added a question here that was not getting any replies:

How can I get around this issue? It seems to be an issue with Codemirror trying to be smart and only render what is on the screen? Can I force it to render everything even if it thinks it’s hidden?

I use Codemirror 5.4.5.

Yes (set the option viewportMargin: Infinity). This might cause terrible performance on big documents, through.

Do you have any CSS transforms or other oddness in the layout of the editor’s parent nodes?

Thanks, that worked! :slight_smile:

I’ve now tested it with 5700 words. It feels a bit slower, but still not terrible at that word length. The same goes for 11000 words. A bit slower but it’s still possible to write ok.

Below is 5700 words test

I have a follow up question (or two).

  1. Do you expect this issue to disapear with Codemirror 6 as I guess it will user contentEditable?
  2. An impossible question perhaps, but do you think Codemirror 6 release are years or months away?

Do you have any CSS transforms or other oddness in the layout of the editor’s parent nodes?

I see now that I did not really reply to your question. I do not have any CSS transform. I however noticed that the problem accur when I click on a file which loads correctly and then click on another tab (we can call it that) and then back again to load the same file again.

So it does this:

  1. Show a wrapper div. Then setValue() and refresh(). Content loads correctly
  2. Hide the wrapper div (showing something else).
  3. Show the wrapper again. Load with setValue() and refresh() again. This time the content get weird. The strange thing is that this does not accur the first time the file loads, but the second time.

If I skip step 1 it works like expected. Something weird happends just because codemirror is already initialized, that is my guess.

Maybe a better way would be to destory the Codemirror somehow and then set it up again when a file loads? The load would maybe be a tiny bit slower that way, but the performance when writing should be fast.

Probably, since it uses a very different way to implement viewport-only rendering, and is thus unlikely to have the same bug.

I’m aiming for a useable release late this year, but yeah, hard to say how that’ll go, since there’s still some fundamental design work ongoing.

That might help work around this issue. Shouldn’t be too expensive. If you can set up a minimal demo that reproduces the problem I’d also be interested in taking a look. In theory refresh should be enough to clear all cached values, but here it seems that’s not happening.