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,25 +699,37 @@ var
procedure AddHistoryCurItem(ForceComp: Boolean); procedure AddHistoryCurItem(ForceComp: Boolean);
var var
CurItmComp: TIdentifierCompatibility; CurItmComp: TIdentifierCompatibility;
j: integer; j, f: integer;
MatchAtStart, HasContainMatch: Boolean;
begin begin
for j := 0 to length(FFoundHistoryItems) - 1 do begin HasContainMatch := False;
CurItem := FFoundHistoryItems[j]; repeat
if (CurItem = nil) then MatchAtStart := not HasContainMatch;
continue; for j := 0 to length(FFoundHistoryItems) - 1 do begin
if ForceComp then CurItem := FFoundHistoryItems[j];
CurItmComp := low(TIdentifierCompatibility) if (CurItem = nil) then
else continue;
CurItmComp := CurItem.Compatibility; if ForceComp then
if (CurItmComp <> HistComp) then CurItmComp := low(TIdentifierCompatibility)
Continue; else
if (CurItem.HistoryIndex > HistoryLimits[CurItmComp]) then CurItmComp := CurItem.Compatibility;
break; if (CurItmComp <> HistComp) then
if (CurItem.Identifier<>'') and (FilterCurItem >= 0) then begin Continue;
CurItem.Flags := CurItem.Flags + [iliIsRecentItem]; if (CurItem.HistoryIndex > HistoryLimits[CurItmComp]) then
InsertCurItem; break;
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; end;
end; until (not HasContainMatch) or (not MatchAtStart)
end; end;
begin begin