fpspreadsheet: Fix word wrap algorithm getting stuck if column width is smaller than the character width.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5222 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-27 17:16:47 +00:00
parent 80e3ae6ef0
commit 1f3e78f896

View File

@ -737,6 +737,7 @@ procedure TsTextPainter.Prepare;
var
lineInfo: TsLineInfo;
ts: TTextStyle;
oldPtr: PChar;
begin
FTotalHeight := 0;
FMaxLinelen := 0;
@ -756,7 +757,10 @@ begin
lineInfo := TsLineInfo.Create;
lineInfo.pStart := FPtr;
lineInfo.BeginsWithFontOfRtpIndex := FRtpIndex;
oldPtr := FPtr;
ScanLine(lineInfo.NumSpaces, lineInfo.Width, lineInfo.Height, lineInfo.WordList);
if oldPtr = FPtr then // Detect scan is stuck
break;
FLines.Add(lineinfo);
FTotalHeight := FTotalHeight + IfThen(FTextRotation = rtStacked, 2, 1)*lineInfo.Height;
FMaxLineLen := Max(FMaxLineLen, lineInfo.Width);
@ -947,6 +951,8 @@ begin
NextChar(1)
else
UTF8Delete(part, UTF8Length(part), 1);
if part = '' then
EOL := true;
end;
EOL := true;
break;