From fbb7991a1f1c004fdd0ff581aab55313a0ea3e18 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 4 Mar 2019 13:58:50 +0000 Subject: [PATCH] Xdiff : missing calculation if there is not additional tab in side2side git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5079 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- xdiff.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xdiff.php b/xdiff.php index 8cd3ed8..ef6eec8 100644 --- a/xdiff.php +++ b/xdiff.php @@ -450,6 +450,8 @@ class xdiff $symbol = null; $side1 = mb_substr (rtrim ($side1), 0, $this->s2sWidth - 1); $side2 = mb_substr (rtrim ($side2), 0, $this->s2sWidth - 1); + $side1 = str_replace ("\t", " ", $side1); + $side2 = str_replace ("\t", " ", $side2); $d .= $side1; $nbtabs = floor ((1 + $this->s2sWidth - mb_strlen ($side1)) / 8); if ($symbol !== null || $side2 !== "") @@ -459,7 +461,12 @@ class xdiff elseif ($symbol !== null) { if (mb_strlen ($side1) < $this->s2sWidth - 1) - $d .= str_repeat (" ", 5); + { + if ($nbtabs > 1) + $d .= str_repeat (" ", 5); + else + $d .= str_repeat (" ", $this->s2sWidth - mb_strlen ($side1) - 1); + } $d .= " ".$symbol; } if ($symbol !== null && $side2 !== "")