mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-29 06:49:27 +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
|
var
|
||||||
StartBytePos: PChar;
|
StartBytePos: PChar;
|
||||||
begin
|
begin
|
||||||
|
if StartCharIndex < 1 then
|
||||||
|
StartCharIndex := 1; //Insert() does this correction too
|
||||||
StartBytePos:=UTF8CodepointStart(PChar(s),length(s),StartCharIndex-1);
|
StartBytePos:=UTF8CodepointStart(PChar(s),length(s),StartCharIndex-1);
|
||||||
if StartBytePos <> nil then
|
if StartBytePos <> nil then
|
||||||
Insert(source, s, StartBytePos-PChar(s)+1);
|
Insert(source, s, StartBytePos-PChar(s)+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user