Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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

+2
−0

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. A diff is a view showing what has changed between the previous text and the new edited text. In the edit history of a Codidact post, paragraphs with deletions are highlighted in red, and paragraphs with additions are highlighted in green. ↩︎

History

1 comment thread

Line-feed-ended files are terminated by a new line feed, so it's only coincidentally helpful for differentials. (3 comments)

Sign up to answer this question »