Domanda

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
});
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top