Gutter linenumber font size doe not match content


#1

Hi,

I am having no success trying to match the gutter linenumber font size with the python content. I have found earlier posts that suggest that this is best managed in the codemirror.css file. I have tried this, but without success. (using codemirror.css in the lib subdirectory). Needless to say, css is not my strong point.

ie. ‘font-size’ added
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
font-size: 11px;
height: 300px;
color: black;
}

I also tried adding ‘font-size’ to CodeMirror-linenumber - without success
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
font-size: 11px;
text-align: right;
color: #999;
white-space: nowrap;
}

An example of the result is:

As you can see, linenumbers do not align with the python statements.

What am I missing?

Colin Goldberg


#2

Are you, by any chance, using an ancient version of CodeMirror? It shouldn’t even be possible for the line number to misalign like that since at least version 3.0 from 2013.


#3

I was actually using 5.24.3, but I was also using a script I found (from source) at https://codemirror.net/1/contrib/python/. This may very well have created its own issue.

I have now installed the latest version 5.25.2, and my test not integrated with my application works beautifully. However, integrating with my application produces an error, which I think deserves its own thread. See “Getting Codemirror internal error: Cannot read property ‘splice’ of undefined”