diff --git a/atsynedit/atsynedit_canvasproc.pas b/atsynedit/atsynedit_canvasproc.pas index edbe241ac..15fc6eef6 100644 --- a/atsynedit/atsynedit_canvasproc.pas +++ b/atsynedit/atsynedit_canvasproc.pas @@ -540,12 +540,9 @@ procedure CanvasTextOut(C: TCanvas; APosX, APosY: integer; AText: atString; ListInt[i]:= ListOffsets[i] * NCharWidth div 100; //truncate AText, to not paint over screen - for i:= 1 to High(ListInt) do - if ListInt[i]>AProps.ControlWidth then - begin - SetLength(AText, i); - Break; - end; + i:= AProps.ControlWidth div AProps.CharSize.X + 2; + if Length(AText)>i then + SetLength(AText, i); Dx[0]:= ListInt[0]; for i:= 1 to High(ListInt) do