What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

When a suggested edit changes the indentation of some code (for example indenting four spaces to get proper formatting), the markdown diff often shows the changed spaces highlighted differently in each line:

diff view

This makes it unnecessarily unclear what really was edited.

Instead, all the lines should just have the first four spaces highlighted.

share|improve this question

2 Answers 2

up vote 11 down vote accepted

Instead, all the lines should just have the first four spaces highlighted.

From the next build on, this will be the case.

When creating those diffs, the diff engine doesn't really care how it distributes the added versus the unchanged space characters (technically, any way of doing it is correct). I've made a change now that forces added or removed tokens to always appear before unchanged tokens tokens that are equal. The only practical difference made by this change that I can think of is the indentation issue that you're bringing up here.

share|improve this answer

I just got this absurd example, where what (as far as I can tell) was just a suggestion adding indentation to a code block resulted in a diff that made it look as though almost all the code had been drastically rewritten:

enter image description here

This is a problem when reviewing these edits because if the user suggesting the edit has changed things other than the indentation, I need to be able to see and review them. In this case, I glanced over the diff, figured it looked like nothing but formatting had changed, and decided to trust the user's edit comment that made no mention of any changes other than code formatting.

But honestly, since I didn't carefully diff it line-by-line myself, I might have just approved all kinds of blatant vandalism, and if that's the case, then I'll probably never know that I did so.

share|improve this answer
This is a valid point, but not directly related to this particular question; more to meta.stackexchange.com/questions/247423/… – balpha Jan 29 at 10:46
This is fixed now via meta.stackexchange.com/questions/247423/…. – balpha Jun 19 at 21:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .