SynEdit: clean up (utf8)

git-svn-id: trunk@39084 -
This commit is contained in:
martin 2012-10-14 19:49:19 +00:00
parent ad7aed810e
commit 5b271f60f6

View File

@ -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;