SynEdit: clean up completion IsIdentifierChar

This commit is contained in:
Martin 2025-02-27 11:00:07 +01:00
parent 7d0db6e423
commit 57240dc768

View File

@ -485,16 +485,11 @@ var
begin
Result := p^ in ['a'..'z','A'..'Z','0'..'9','_'];
if Result then exit;
if p^ <= #127 then exit;
i := UTF8CodepointSize(p);
SetLength(u, i);
// wide chars of UTF-16 <= bytes of UTF-8 string
if ConvertUTF8ToUTF16(PWideChar(u), i + 1, p, i, [toInvalidCharToSymbol], L) = trNoError
then begin
SetLength(u, L - 1);
if L > 1 then
Result := TCharacter.IsLetterOrDigit(u, 1);
end;
if i <= 1 then exit;
SetLength(u{%H-}, 3); // surrogate and trailing #0
if ConvertUTF8ToUTF16(PWideChar(u), 3, p, i, [toInvalidCharToSymbol], L) = trNoError then
Result := TCharacter.IsLetterOrDigit(u, 1);
end;
{ TSynBaseCompletionFormScrollBar }