marijnh/CodeMirror2 — Issue #326: Line numbers are sometimes off by one when code is folded
Author: njx
Created: 2012-01-11 23:58:56+00:00
State: open

1. Open demo/folding.html
2. Delete the content of the editor
3. Paste the contents of codemirror.js into it
4. Scroll up to the top
5. Click in the gutter next to line 9 ("function CodeMirror(place, givenOptions)") to fold it
-> This collapses a large block of code
6. Scroll down a half page or so, so the end brace of the CodeMirror function is scrolled off the top (you should be in the middle of the CodeMirror.defaults block)
7. Look at the line number next to the "lineNumbers" property
8. Double-click the word "lineNumbers" while watching its line number

Result: The line numbers in the gutter shift, so the line number appears to be one less now. If you scroll back up to the folded code and then scroll back down, the line number is correct again.