WrapText hangs if Length(BreakStr) = 1
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
If WrapText is called with BreakStr that has Length = 1 (this is usual on UNIXes where line ending is #10 so usually WrapText is used with BreakStr = #10) and BreakStr occurs in input string somewhere, WrapText hangs infinitely.
That's because of a simple bug in WrapText, when BreakStr is found in Line P is incremented by BLen-1 but it should be incremented by BLen. Here's a patch to rtl/objpas/sysutils/sysstr.inc
--- sysstr.inc 19 Dec 2004 17:55:38 -0000 1.23
+++ sysstr.inc 26 Dec 2004 09:36:22 -0000
@@ -2215,7 +2215,7 @@
begin
HB:=((C=BC) and (BreakStr=Copy(L,P,BLen)));
If HB then
- Inc(P,Blen-1)
+ Inc(P,Blen)
else
begin
If (P>MaxCol) then
Additional information:
Reporter: Michalis Kamburelis
EMail: michalis at camelot dot homedns dot org
Mantis conversion info:
- Mantis ID: 5472
- OS: Linux
- Version: 1.9.5
- Fixed in version: 1.9.5