Search code examples
javascriptcodemirror

Forcing CodeMirror ScrollBars into visibility programmatically


I have a CodeMirror textbox within a jQuery dialog.

For some reason, the CodeMirror scroll bars refuse to show up until a character is typed, even if I resize the window until code in the CodeMirror is covered up.

Is there a hook in the CodeMirror API to programmatically make the show up?

As a note, I have lineWrapping set to false and I am calling CodeMirror's resize event when the jQuery dialog's resize event fires.


Solution

  • Got the answer on the CodeMirror forums:

    https://discuss.codemirror.net/t/is-there-a-way-to-force-scrollbars-to-appear/576/3

    All you need to do is call the setSize(null, null) on your CodeMirror instance.