summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/corelib/fpgfx.pas5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas
index 1d5a23cc..bbc530d7 100644
--- a/src/corelib/fpgfx.pas
+++ b/src/corelib/fpgfx.pas
@@ -1107,7 +1107,8 @@ end;
{ TfpgCanvas }
// Warning! This function is not supposed to handle existing line breaks,
-// it is only supposed to insert new ones when appropriate.
+// it is only supposed to insert new ones when appropriate. Also, this function
+// simply inserts line breaks, it doesn't split text lines etc...
function TfpgCanvas.AddLineBreaks(const s: TfpgString; aMaxLineWidth: integer): string;
var
i, n, ls: integer;
@@ -1141,7 +1142,7 @@ begin
if (lw + tw > aMaxLineWidth) and (lw > 0) then
begin
lw := tw;
- Result := Result + sLineBreak;
+ Result := TrimRight(Result) + sLineBreak;
end else
Inc(lw, tw);
Result := Result + sub;