Requests for comment/Inline diffs

needs a product manager Sharihareswara (WMF) (talk) 16:51, 17 June 2014 (UTC)

I propose to integrate inline (one-column) diffs from MobileFrontend into MediaWiki core. Mobile screens are smaller so standard side-by-side diffs aren't good. To address this, the mobile team developed a new diff mode which we feel might be useful for desktop too. Example diff.

Implementation details
Inline diffs use existing core diff code as much as possible, therefore the code is very compact and has the same performance characteristics as two-column diffs. Just two small classes: diff formatter and a DifferenceEngine subclass - this should not create maintenance problems.

Because performance matters, Wikimedia's PHP extension wikidiff2 already supports inline diffs.

Intended goals
Primary: Whether inline diffs should be integrated into core.

Secondary: if we decide to integrate, I'd like comments on some details.
 * Current mobile designs don't show numbers of modified lines, however the diffs contain everything for core to display them, for example:   . How exactly should line numbers look like? My current idea is "Lines 123/456" and it looks ugly.
 * How to switch between diff modes? My current thought is to display old diffs by default but offer a link to inline version on diff view and remember this choice (in user prefs? via cookie?).
 * Large inline diffs can be cryptic - should MediaWiki automatically switch to side-by-side mode if the change is huge?
 * Extension:wikEdDiff (see below) does not suffer from this type of fragmentation due to optimizations. Cacycle (talk) 13:12, 7 October 2014 (UTC)

Comments

 * The red/green color scheme presents accessability issues for color-blind readers. Should the default yellow/blue scheme be used? Should +/− indicators be used? — Edokter  ( talk ) — 19:00, 13 February 2014 (UTC)
 * This is a mobile design which is not necessary to be ported to desktop - however our design team claims that it covers most cases of colorblindness. Yellow and blue covers more cases however unlike side-by-side diffs these colors don't give you idea what was removed and what added. We tried pluses and minuses, looked ugly. Probably, removals can be stricken out. Max Semenik (talk) 22:53, 13 February 2014 (UTC)
 * Please use a standard style. More in general however, dwdiff -c is rather outstanding for clarity IMHO. --Nemo 23:27, 13 February 2014 (UTC)
 * (Sidenote: screenshot and comment on, for other curious folks.) –Quiddity (talk) 17:18, 4 July 2014 (UTC)
 * I'm not good enough for commenting the proposal, but thanks a bunch for working on diffs! They're a crucial part of MediaWiki and they're so completely neglected. --Nemo 23:27, 13 February 2014 (UTC)
 * "How to switch between diff modes?" I agree with displaying old diffs with a link to this format by default and having a user preference for it. Perhaps some URL parameter like diffalgo could be used. πr2 (t • c) 01:21, 28 February 2014 (UTC)
 * +1 from me, for the defaulting to old-diffs, but remembering per user if we click the toggle. (ie. use a Hidden preference. It wouldn't need to appear separately within the Special:Preferences menus.) Once it is live and stable, and getting positive feedback, then might be a good time to consider whether 'some of the smaller diffs' should use the inline diff as default. –Quiddity (talk) 01:52, 20 June 2014 (UTC)
 * There's also the inline diff currently seen/used in Navpopups, eg File:Navpopups diff screenshot.png, which could potentially benefit from any work accomplished here? –Quiddity (talk) 22:03, 6 March 2014 (UTC)
 * There's also en:User:Cacycle/wikEdDiff (a userscript) which creates an inline diff, eg File:WikEdDiff screenshot.png. –Quiddity (talk) 20:02, 29 March 2014 (UTC)
 * There's also this series of 3 design mockups from December, File:Flow-diffs-comment-04.png and File:Flow-diffs-comment-spec-04.png and File:Flow-diffs-topic-06.png. (Basically the same idea/design as above; I'm just adding them for completism). –Quiddity (talk) 01:52, 20 June 2014 (UTC)
 * I'm supportive of at least experimenting with this, perhaps bringing it to our user base and seeing if they want it. Bawolff (talk) 19:28, 21 June 2014 (UTC)
 * FYI: I have ported the JavaScript library wikEd diff to PHP and created the new extension wikEdDiff. wikEdDiff is a visual inline-style difference engine with block move support. You can test wikEdDiff by checking any of these gadgets in your English Wikipedia preferences. For testing the effects of different settings, you can also use the wikEd diff online tool and demo. It is still experimental and might have performance issues on edge cases. Also, the code is not yet online. Cacycle (talk) 13:12, 7 October 2014 (UTC)