Is there a way to force scrollbars to appear?

I have a CodeMirror 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.

Thanks!

What do you mean by calling CodeMirror’s resize event?

Calling its setSize method without arguments should make it update its understanding of its size.

My apologies, I misread the code. jQuery’s resize() method is being called, so that’s probably not relevant to the question.

Here are some pics of the issue I’m having. My problem is the ScrollBar’s don’t show up until the user starts typing:

Pre-typing:

After typing the letter ‘a’:

Is that a better description? It’s really aggravating when you just want to read the code instead of editing it. I don’t want to have to type a letter to view the end of a long line (or when the dialog box is small because of a small screen).

Call your CodeMirror instance’s setSize method after resizing the container that the editor is in.

Awesome, thank you Marijn!

To clarify the appropriate API call is: codeMirrorInst.setSize(null, null)