Recent Changes - Search:

PITS main list

edit sidebar

Main sidebar

PmWiki

pmwiki.org

01192

Summary: DiffRenderSource should collapse adjacent inline insertions and deletions
Created: 2010-05-10 06:35
Status: Closed - added for 2.2.17
Category: Feature
Assigned:
Priority: 5
Version: 2.2.12+

Description: With $EnableDiffInline set (by default from 2.2.13), DiffRenderSource will do word-level highlighting for changes. Quite often this will display the modification of adjacent words as separate diffs, with output such as "<ins>new</ins> <ins>words</ins>" instead of "<ins>new words</ins>".

These adjacent additions or removals should be combined, eg. with the following modification:

Index: pagerev.php
===================================================================
--- pagerev.php	(revision 2555)
+++ pagerev.php	(working copy)
@@ -198,6 +198,7 @@
   $z2[0] = $line.$z2[0];
   foreach ($cnt as $a) $lines[] = implode('', array_slice($z2, $a[0], $a[1]));
   $ret = trim(implode("\n", $lines));
+  $ret = preg_replace('!</(del|ins)> <\1>!', ' ', $ret);
   return str_replace("\n","<br />",$ret);
 }
 ## Split a line into pieces before passing it through `diff`
Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:56 AM