Requests for comment/Inline diffs

From mediawiki.org
Request for comment (RFC)
Component General
Creation date
Author(s) Max Semenik (talk)
Document status in discussion
See Phabricator.

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

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[edit]

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[edit]

Proposed UI to switch mode from diff view.

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: <div class="mw-diff-inline-header"><!-- LINES 123,456 --></div>. 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?

Comments[edit]