Index: core/string_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v
retrieving revision 1.55
diff -u -r1.55 string_api.php
--- core/string_api.php	22 Jul 2004 13:42:02 -0000	1.55
+++ core/string_api.php	30 Jul 2004 22:36:19 -0000
@@ -55,6 +55,15 @@
 		$p_string = string_preserve_spaces_at_bol( $p_string );
 		$p_string = nl2br( $p_string );
 
+		# fix up eols within <pre> tags (#1146)
+		preg_match_all("/<pre[^>]*?>(.|\n)*?<\/pre>/", $p_string, $pre1);
+		for ($x = 0; $x < count($pre1[0]); $x++) {
+			$pre2[$x] = preg_replace("/<br[^>]*?>/", "", $pre1[0][$x]);
+			$pre2[$x] = preg_replace("/([^\n]{".$wrap."})(?!<\/pre>)/", "$1\n", $pre2[$x]);
+			$pre1[0][$x] = "/" . preg_quote($pre1[0][$x], "/") . "/";
+		}
+		$p_string = preg_replace($pre1[0], $pre2, $p_string);
+
 		return $p_string;
 	}
 
