Browse Source

fix delete text after

Unknown 6 years ago
parent
commit
b262937e92
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lazpaintcontrols/lcvectortextshapes.pas

+ 3 - 2
lazpaintcontrols/lcvectortextshapes.pas

@@ -310,14 +310,15 @@ end;
 procedure TTextShape.DeleteTextAfter(ACount: integer);
 var
   delCount, selRight: Integer;
+  tl: TBidiTextLayout;
 begin
   BeginUpdate;
   selRight := Max(FSelStart,FSelEnd);
-  if selRight > 0 then
+  tl := GetTextLayoutIgnoreMatrix;
+  if selRight+ACount <= tl.CharCount then
   begin
     delCount := GetTextLayoutIgnoreMatrix.DeleteText(selRight, ACount);
     FText := GetTextLayoutIgnoreMatrix.TextUTF8;
-    inc(selRight,delCount);
   end;
   FSelStart := selRight;
   FSelEnd := selRight;