Page MenuHomePhabricator

Diffs hard to read in Special:MobileDiff (broken up into per word) as whitespace is considered a delimiter
Closed, ResolvedPublic

Description

Steps to reproduce: visit https://en.wikipedia.org/wiki/Special:MobileDiff/965624274 and scroll past the infobox to the opening paragraph.

Actual results: See screenshot

Screenshot_20210425-080554.png (1×1 px, 433 KB)
. When there are sequential words that are changed, every space between words is considered "unchanged." This slices up the diff'd section, making the MobileDiff nearly unreadable (in terms of sentence-level reading comprehension).

Expected results: <red>active in the [[conservation (ethic)|conservation]],</red> <green>that has raised more than</green>

Bug fix/feature request:

Change the logic so that the change "eat food" -> "drink water" is treated as a single changed fragment, without the " " being recognized as an unchanged section, while preserving the behavior of "eat some food" -> "drink some water", in which " some " is recognized as unchanged.

This will be a tweak to the logic that treats words as indivisible chunks - e.g. if "ten" is changed to "hundred", you don't see the "e" treated as "unchanged".

If the MediaWiki code is explicitly identifying the fragments of text which are considered "unchanged," then this should be a very simple fix:
A) require an unchanged fragment to be >1 character long
B) require an unchanged fragment to be something like "\s+\S+\s+", i.e. whitespace, non-whitespace, whitespace.

If the MediaWiki code only explicitly identifies *changed* fragments, then it should, afterward, scan through the gaps between them - the *unchanged* fragements - and in the above cases (A and B), merge the surrounding changed fragments into one, i.e. merge "eat"," ","food" -> "eat food" as the single changed fragment.

Event Timeline

Note: this is a specific case of whitespace handling, which I have laid out in detail because I can specifically suggest the fix.

A broader collection of feature/bugfix requests around whitespace handling can be found at https://en.wikipedia.org/wiki/Help_talk:Diff#Better_white-space_handling_needed . I have created a separate ticket for the broader topic: https://phabricator.wikimedia.org/T281057

Aklapper renamed this task from In diff, don't count spaces as "unchanged text" (simple fix for readability of MobileDiff) to Diffs hard to read in Special:MobileDiff (broken up into per word) as whitespace is considered a delimiter.Apr 25 2021, 2:50 PM
Aklapper edited projects, added wikidiff2; removed MediaWiki-Page-diffs.
ovasileva triaged this task as Medium priority.Apr 26 2021, 2:52 PM
ovasileva added a project: Web-Team-Backlog.
ovasileva moved this task from Incoming to Triaged but Future on the Web-Team-Backlog board.
ovasileva moved this task from Needs triage to Triaged on the Mobile board.
Jdlrobson subscribed.

The diff code is actually in core in wikidiff2 these days. Special:MobileDiff is just a wrapper.
See also https://en.wikipedia.org/w/index.php?title=World_Land_Trust&diff=965624274&diff-type=inline&diffmode=source for the non-MobileFrontend representation.

Jdlrobson claimed this task.

The mobile site now uses the same code as the desktop site. Please see T358293 for more information. For any new or related bugs please file them under MediaWiki-Page-diffs