mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-02 23:37:18 +01:00
SynEdit: clean up (utf8)
git-svn-id: trunk@39084 -
This commit is contained in:
parent
ad7aed810e
commit
5b271f60f6
@ -1535,16 +1535,12 @@ end;
|
||||
|
||||
// Only needed if the Selection is set from External
|
||||
function TSynEditSelection.AdjustBytePosToCharacterStart(Line : integer; BytePos : integer) : integer;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
Result := BytePos;
|
||||
if Result < 1 then
|
||||
Result := 1
|
||||
else if (Line >= 1) and (Line <= FLines.Count) then begin
|
||||
s := FLines[Line-1];
|
||||
if (Result <= length(s)) and FLines.IsUtf8 then
|
||||
Result:=UTF8FindNearestCharStart(PChar(Pointer(s)),length(s),Result - 1) + 1;
|
||||
Result := FLines.LogicPosAdjustToChar(FLines[Line-1], Result, False);
|
||||
end;
|
||||
if Result <> BytePos then debugln(['Selection needed byte adjustment Line=', Line, ' BytePos=', BytePos, ' Result=', Result]);
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user