Welcome to Codidact Meta!
Codidact Meta is the "town hall" (meta-discussion site) for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.
Confusing highlighting of a paragraph with no changes
A new paragraph was added at the end of a post, as can be seen in its edit history. In this case it happened to be a footnote, but that is not relevant here. The diff[1] shows the new paragraph at the end, but also highlights the entire previous paragraph, making me think that there was some change to it that I'm missing. However, the only change to the previous paragraph was having a newline added to the end of it to make space for the new paragraph. This is confusing for someone who expects the change to be within the highlighted paragraph.
In some programming languages there is a convention of always ending a program file with a newline (effectively a blank line at the end of the program) to avoid such confusion in the diff when new text is later added at the end. This way the newline separating the new text at the end was already present, so doesn't cause the previous text to be displayed as having changed.
Should we change the behaviour of our diffs to avoid this confusion? Perhaps by automatically adding a newline at the end of a post that doesn't already end that way. Alternatively, we could avoid highlighting paragraphs where the only change is the addition or removal of a final newline.
Would either of these approaches cause other problems? What is the best approach to take?

1 comment thread