Browse Source

avoid cursor being inside multichar

Johann 5 years ago
parent
commit
d137fb9fd0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lazpaintcontrols/lcvectortextshapes.pas

+ 4 - 0
lazpaintcontrols/lcvectortextshapes.pas

@@ -861,6 +861,7 @@ begin
     FText := GetTextLayout.TextUTF8;
     FText := GetTextLayout.TextUTF8;
     dec(selLeft,delCount);
     dec(selLeft,delCount);
   end;
   end;
+  inc(selLeft, GetTextLayout.IncludeNonSpacingChars(selLeft, 0));
   FSelStart := selLeft;
   FSelStart := selLeft;
   FSelEnd := selLeft;
   FSelEnd := selLeft;
   EndUpdate;
   EndUpdate;
@@ -880,6 +881,7 @@ begin
     tl.DeleteText(selRight, ACount);
     tl.DeleteText(selRight, ACount);
     FText := tl.TextUTF8;
     FText := tl.TextUTF8;
   end;
   end;
+  inc(selRight, GetTextLayout.IncludeNonSpacingChars(selRight, 0));
   FSelStart := selRight;
   FSelStart := selRight;
   FSelEnd := selRight;
   FSelEnd := selRight;
   EndUpdate;
   EndUpdate;
@@ -895,6 +897,7 @@ begin
     selLeft := Min(FSelStart,FSelEnd);
     selLeft := Min(FSelStart,FSelEnd);
     GetTextLayout.DeleteText(selLeft, Abs(FSelEnd-FSelStart));
     GetTextLayout.DeleteText(selLeft, Abs(FSelEnd-FSelStart));
     FText := GetTextLayout.TextUTF8;
     FText := GetTextLayout.TextUTF8;
+    inc(selLeft, GetTextLayout.IncludeNonSpacingChars(selLeft, 0));
     FSelStart := selLeft;
     FSelStart := selLeft;
     FSelEnd := selLeft;
     FSelEnd := selLeft;
     EndUpdate;
     EndUpdate;
@@ -922,6 +925,7 @@ begin
   insertCount := GetTextLayout.InsertText(ATextUTF8, FSelStart);
   insertCount := GetTextLayout.InsertText(ATextUTF8, FSelStart);
   FText := GetTextLayout.TextUTF8;
   FText := GetTextLayout.TextUTF8;
   Inc(FSelStart, insertCount);
   Inc(FSelStart, insertCount);
+  inc(FSelStart, GetTextLayout.IncludeNonSpacingChars(FSelStart, 0));
   FSelEnd := FSelStart;
   FSelEnd := FSelStart;
   EndUpdate;
   EndUpdate;
 end;
 end;