From d5472dbae22a819764808f75e9c991b14a7569ce Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 11 Sep 2005 05:21:58 +0000 Subject: [PATCH] Enable word wrapping --- includes/svnlib.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/includes/svnlib.php b/includes/svnlib.php index c4a7bee..30d2b8c 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -90,7 +90,15 @@ class SVNLib $string = str_replace("\t", ' ', $string); // spaces to nbsp - $string = str_replace(' ', ' ', $string); + if (true) + { + $string = preg_replace('#( +)#e', '$this->format_spaces("\1")', $string); + } + // no word wrap + else + { + $string = str_replace(' ', ' ', $string); + } // convert advanced diff $string = str_replace(array('{@++}', '{@--}'), array('', ''), $string); @@ -102,6 +110,25 @@ class SVNLib return $string; } + /** + * Counts the spaces and replaces two or more ones + * + * @access private + * + * @param string Spaced string + * + * @return string  'd string + */ + function format_spaces($thestring) + { + if (strlen($thestring) >= 2) + { + $thestring = str_replace(' ', ' ', $thestring); + } + + return $thestring; + } + /** * Executes the SVN binary * -- 2.22.5