mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-18 13:39:16 +02:00
LazUtf8: correct a StartCharIndex < 1 in Utf8Insert. Reason: consistent with System.Insert().
This commit is contained in:
parent
06a86413f2
commit
913b749fa9
@ -1190,6 +1190,8 @@ procedure UTF8Insert(const source: String; var s: String; StartCharIndex: PtrInt
|
||||
var
|
||||
StartBytePos: PChar;
|
||||
begin
|
||||
if StartCharIndex < 1 then
|
||||
StartCharIndex := 1; //Insert() does this correction too
|
||||
StartBytePos:=UTF8CodepointStart(PChar(s),length(s),StartCharIndex-1);
|
||||
if StartBytePos <> nil then
|
||||
Insert(source, s, StartBytePos-PChar(s)+1);
|
||||
|
Loading…
Reference in New Issue
Block a user