From 854b855a22e61237c20efd5bc38f1c91eba7e19c Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 31 Oct 2011 20:57:58 +0100 Subject: Fix broken at beginning of highlighted diff If a regex matches on lines that begin with a space, it will create a tag directly at teh beginning of the code. The return statment removes the first char which in this case will be "<" so the html tag will be broken and there will be a left over space. If we don't add the space in the first place, we don't have to remove it. This looks like some crazy workaround, so it might cause problems to appear. Signed-off-by: Florian Pritz --- application/libraries/geshi.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'application/libraries/geshi.php') diff --git a/application/libraries/geshi.php b/application/libraries/geshi.php index f6796c9f6..c654fa2a7 100644 --- a/application/libraries/geshi.php +++ b/application/libraries/geshi.php @@ -3267,7 +3267,7 @@ class Geshi { * @todo BUGGY! Why? Why not build string and return? */ function parse_non_string_part($stuff_to_parse) { - $stuff_to_parse = ' ' . $this->hsc($stuff_to_parse); + $stuff_to_parse = $this->hsc($stuff_to_parse); // Highlight keywords $disallowed_before = "(?|^&"; @@ -3576,7 +3576,7 @@ class Geshi { $stuff_to_parse = str_replace('<|', '', '', $stuff_to_parse ); - return substr($stuff_to_parse, 1); + return $stuff_to_parse; } /** -- cgit v1.2.3-24-g4f1b