Skip to content

Adding/Removing new lines doesn't show in description diffs

Summary

Description diffs don't currently show addition or removal of newline characters.

image

This could lead to a confusing situation where a change only adding newlines would create a system note with nothing highlighted in the diff.

Context: #10103 (comment 246564553)

Steps to reproduce

  1. Visit an issue in a project with description diffs enabled (e.g. https://gitlab.com/gitlab-org/gitlab/issues)
  2. Edit issue description to only add/remove new lines
  3. Expand the new system note and observe the diff

Example Project

#38094 (closed) (this issue!)

What is the expected correct behavior?

Newline characters should be highlighted in green or red in the diff.

Possible fixes

Diffs are generated by storing the whole description using Rails' description_before_last_save method, so it's likely this is to do with rendering new lines in the system note diffs.

Edited by John Hope