When a single letter s or d is added to a word, the entire new word is highlighted as if the entire word would be completely new. It would help a lot by differentiating between letters that have been present before (say, light-green) and letters that have been added anew (dark green), like this:

mockup of a suggested diff

or maybe weatherwhether. Thus highlighting two characters on each side.

As I currently see it, criteria for highlighting could be as follows:

  1. light red/green means: this text remains definitely unchanged, it is only here to get a better context. It might contain additions/deletions like wetherwhether. But not necessarily each and every unchanged character or substring is colored light that remains unchanged.

  2. dark red/green means everything else. Thus, this text is deleted/new, or it is too complex to explain the precise differences and thus we assume to delete it completely and retype it. Otherwise, cases like suggested by @Juhana would appear.

  3. within a word the number of changes between light/dark is limited to a few changes only.

The reason why your edit looks a bit too far, is that the change of the a and h are "crossed".

Edit: This is not a duplicate. I am suggesting here an additional color/shade to permit a better differentiation between actually new characters and the word-context.

My suggestion thus would change the current diff only by changing some text from light-green to dark green.

Edit: Here is an example I just had while reviewing. It took my quite a while to see the actual difference. A better highlighting would help here:

Tiny difference in markdown diff

  • 1
    I've added an example of what I think you mean; am I understanding correctly? In that case, I agree it's not a dupe of that other question. /cc @benisuǝqbackwards
    – balpha Staff
    Mar 11, 2013 at 17:00
  • @balpha: Exactly!
    – false
    Mar 11, 2013 at 17:41
  • @balpha: I added an alternate version
    – false
    Mar 11, 2013 at 19:19
  • Can you clarify how (in your alternate version) you would choose what characters to include? Highlighting "a" and "h" as in my image is clear, but what would be the criteria for "highlight letters that haven't actually changed"?
    – balpha Staff
    Mar 11, 2013 at 19:49
  • @balpha: See above.
    – false
    Mar 11, 2013 at 20:15

1 Answer 1


The reason for this not being such a hot idea is the same why character-by-character diff isn't implemented in the first place. It works fine in the simplest of cases...

enter image description here

...but it breaks horribly when the change is anything more radical than a typo fix.

enter image description here

  • It does not make sense for a case as you have suggested. In your case, only the "ly " make sense to remain - if at all. All other characters should be dark-red/dark-green.
    – false
    Mar 11, 2013 at 18:43
  • 3
    Why? All the dark colored characters are duplicates (ta, ly, r, d) and light characters have changed.
    – JJJ
    Mar 11, 2013 at 18:45
  • OK, maybe the "ta" but it is within a word, and there is another better constant part already ("ly "). Single letters that are within a word do not make sense. The point of the additional highlighting should suggest a typical editorial action. Changing everything up to a single character is not what one would do. (Imagine sitting beside someone telling how to edit). When reviewing edits it is currently very distracting to figure out where something has changed and where not. The idea is to speed up this part for humans.
    – false
    Mar 11, 2013 at 18:57
  • 1
    @false Yes, but how can the diff highlighter tell whether a human would think it right to keep it or not? wrong -> incorrect would keep the r, and the diff highlighter has no way of knowing that it looks awkward.
    – Doorknob
    Mar 12, 2013 at 21:17
  • @Doorknob: highlighting a single letter is probably not worth it, but even if: with a less intrusive coloring this should not be too annoying. I did not propose such an extreme green as Juhana has used.
    – false
    Mar 12, 2013 at 21:27
  • 1
    @false Highlighting a single letter is not worth it? That's exactly what you proposed in your question!
    – Doorknob
    Mar 12, 2013 at 21:28
  • @Doorknob: terminology is a bit difficult here: What I suggested in my question was highlighting an addition/deletion of (also) a single character. But in the case you gave, we are talking about focusing on a single letter that remains constant. Since this single letter would be different to its surroundings it is also "highlighted" but by using the paler font.
    – false
    Mar 12, 2013 at 21:32
  • 1
    How about a threshold? For example, if more than 35% of the word has changed, then consider that the whole word has changed. We could certainly rule out most of the cases where char-by-char diff will break horribly.
    – ADTC
    Jan 3, 2014 at 18:06

You must log in to answer this question.

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