From 14dd2ea4751142594de4e5dbd3c2261bff33b758 Mon Sep 17 00:00:00 2001 From: Alexey-t Date: Thu, 27 Feb 2020 21:15:25 +0300 Subject: [PATCH] optim: truncate too long str on rendeding --- atsynedit/atsynedit_canvasproc.pas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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