a display bug

i find that when i set parent node’s style display to none of CodeMirror, then use the replaceSelection() API to replace some contents, and then i set parent node’s style display to block, the contents of CodeMirror didn’t change until after i click the editor area. is this a bug? i can solve this problem use refresh() API, but i just want to know if there is any better way to solve this problem.

No, refresh() is the way to solve this. The editor has no way to notice that it became visible.