Question

When you apply line numbers to code mirror, they only show if the line actually has content. See this example fiddle. It only shows line numbers 1-5.

I'm wondering if there is a configuration to instead show line numbers for the entire height? (instead of blank entries)?

I've been looking through the documentation but I can't seem to find anything on this. Any suggestions?

This is my basic configuration:

var myCodeMirror = CodeMirror(document.body, {
  value: "function myScript()\n{\n\treturn 100;\n}\n",
  mode:  "javascript",
  lineNumbers: true
});
Was it helpful?

Solution

Ugly workaround: just append \n until it starts scrolling (check scrollTop and scrollHeight).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top