Page MenuHomePhabricator

Changes in lines with only one word are not detected as change
Open, Needs TriagePublic

Description

Looking at the diff of a page where there is only one "word" on a line and where that "word" is changed will result in a diff view that shows an addition and a deletion instead of a change.

e.g.:
https://sv.wikipedia.org/w/index.php?diff=46200983
https://de.wikipedia.org/w/index.php?diff=191311206

Expected behavior:

OneWordDiffTest.png (70×1 px, 4 KB)

This was originally mentioned in T164795#5411230

Event Timeline

thiemowmde added subscribers: jkroll, awight, thiemowmde.

For future reference, I will archive the email thread we had about this issue:

on first glance, this seems to be what's happening: The amount of change between lines is above the threshold, so the change gets converted to an add plus delete. This is intentional, we added this so that the change detection can kick in.
I'm just making sure I understand what's the bug here. Should this be re-merged as one changed line? That does happen when a moved paragraph is detected with a target that immediately follows, but not in this case, probably because the amount of changed characters is 100%.
It surely looks weird if you compare it with the output before, but what should be done here if we 'fix' it? Add a special case when the change is only one word, regardless of the character count?

When a diff only contains one single change, it makes no sense to convert a change to an add plus delete. We could add a special case for that. Could be an easy fix for this.