Codetools: IdentifierCompletion, with "include identifier containing prefix" sort recent entries with true prefix before such "only containing" (same as for non recent items)

This commit is contained in:
Martin 2023-07-24 12:05:21 +02:00
parent 5f5b9dce29
commit a747d43139

View File

@ -699,8 +699,12 @@ var
procedure AddHistoryCurItem(ForceComp: Boolean);
var
CurItmComp: TIdentifierCompatibility;
j: integer;
j, f: integer;
MatchAtStart, HasContainMatch: Boolean;
begin
HasContainMatch := False;
repeat
MatchAtStart := not HasContainMatch;
for j := 0 to length(FFoundHistoryItems) - 1 do begin
CurItem := FFoundHistoryItems[j];
if (CurItem = nil) then
@ -713,12 +717,20 @@ var
Continue;
if (CurItem.HistoryIndex > HistoryLimits[CurItmComp]) then
break;
if (CurItem.Identifier<>'') and (FilterCurItem >= 0) then begin
if (CurItem.Identifier<>'') then begin
f := FilterCurItem;
if f > 0 then
HasContainMatch := True;
if ( (f = 0) and MatchAtStart) or
( (f > 0) and not MatchAtStart)
then begin
CurItem.Flags := CurItem.Flags + [iliIsRecentItem];
InsertCurItem;
end;
end;
end;
until (not HasContainMatch) or (not MatchAtStart)
end;
begin
if not (ilfFilteredListNeedsUpdate in FFlags) then exit;