Fix blob preview diff hiding blank added lines
What does this MR do and why?
In the single-file editor's Preview Changes diff, a blank added (or removed) line was dropped from the view — even though the file was saved correctly. This fixes the preview rendering.
A blank added/removed line arrives as the bare prefix character (e.g. "+"), which is not blank? in Rails. The diff_line_content helper stripped the prefix and returned "", so the cell rendered as a zero-height table row and the line appeared to vanish. We now fall back to a non-breaking space so the row keeps visible height — the same convention already used for fully-blank lines one branch up in the helper.
The shared helper is safe to change: all other callers (MR/commit/parallel diff views) pass line.rich_text (non-empty highlighted HTML), so only the blob preview path — which passes raw line.text — is affected.
References
- Resolves #542202 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Edit a file with two methods separated by one blank line in the single-file editor.
- Insert a new method between them, leaving one blank line above and below it.
- Open the Preview Changes tab.
- Both blank lines now render as visible added rows (previously the line below was missing).
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.

