#88 file pages: phantom final line for trailing newline / CRLF

closeduiopened
details
updated
id
222f483f-c2d5-4e86-aaa0-e79afe87fe9d

What

render_text_pre (src/build.rs:1028) splits on \n without dropping the trailing terminator or \r.

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.

all issues