You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of TSynGeneralSyn.SetKeyWords first turns all the strings in its TUnicodeStrings parameter, then forces it to be Sorted (see snippet below) before the method exits.
Does anyone know if there is a particular rationale for it ?
Otherwise it seems to be that FKeyWords should be where the uppercase is applied.
procedure TSynGeneralSyn.SetKeyWords(const Value: TUnicodeStrings);
var
i: Integer;
begin
if Value <> nil then
begin
Value.BeginUpdate;
for i := 0 to Value.Count - 1 do
Value[i] := SynWideUpperCase(Value[i]);
Value.EndUpdate;
end;
TUnicodeStringList(FKeyWords).Sorted := False;
FKeyWords.Assign(Value);
TUnicodeStringList(FKeyWords).Sorted := True;
DefHighLightChange(nil);
end;
The text was updated successfully, but these errors were encountered:
Yes, but why mutate the list passed in parameter ?
Also it's the parameter list that is set to unsorted, not the destination list, and keywords are rarely changed in an highlighter (usually once at initialization).
AFAICT this would be similar without affecting the parameter list:
procedure TSynGeneralSyn.SetKeyWords(const Value: TUnicodeStrings);
var
i: Integer;
begin
FKeyWords.BeginUpdate;
FKeyWords.Clear;
if Value <> nil then
begin
for i := 0 to Value.Count - 1 do
FKeyWords.Add(SynWideUpperCase(Value[i]));
end;
FKeyWords.EndUpdate;
DefHighLightChange(nil);
end;
The implementation of TSynGeneralSyn.SetKeyWords first turns all the strings in its TUnicodeStrings parameter, then forces it to be Sorted (see snippet below) before the method exits.
Does anyone know if there is a particular rationale for it ?
Otherwise it seems to be that FKeyWords should be where the uppercase is applied.
The text was updated successfully, but these errors were encountered: