#88 file pages: phantom final line for trailing newline / CRLF
What
render_text_pre (src/build.rs:1028) splits on \n without dropping the trailing terminator or \r.
- a 403-line file ending in
\nrenders 404 numbered lines (last one empty) while the toolbar says “403 lines” - CRLF files keep
\rin the output and also get the phantom line
Reproduced
wc -l src/highlight.rs # 403
grep -o 'id="L[0-9]*"' dist/files/src/highlight.rs.html | tail -1 # L404
Impact
Visible off-by-one gutter and anchor; copy-paste on CRLF files carries stray CR.
Fix
Normalize \r\n/\r to \n, strip one trailing \n, then split. Keep the empty-file special case. Test a trailing-newline file and a CRLF file for exact line count and no empty last line.
Comments (0)
No comments yet.