View Issue Details

IDProjectCategoryView StatusLast Update
0036802FPCRTLpublic2020-03-20 14:32
ReporterCudaText man Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version3.3.1 
Summary0036802: Request: fgl TFPSList.SortRange
Descriptionhttps://github.com/graemeg/freepascal/blob/master/rtl/objpas/fgl.pp
Many text editors support sorting not only of entire text, but of selected lines. So I need the TFPSList.SortRange(AIndexFrom, AIndexTo) method to do it. Without SortRange, my editor needs to create 2nd list, sort it, move it. This is bad on huge lists (50M items) - memory usage, slow copying list1->list2, list2->list1.

fgl unit gives TFPSList.Sort like this:
procedure TFPSList.Sort(Compare: TFPSListCompareFunc; SortingAlgorithm: PSortingAlgorithm);
var
  Context: TFPSList_Sort_Comparer_Context;
begin
  Context.Compare := Compare;
  SortingAlgorithm^.ItemListSorter_ContextComparer(FList, FCount, FItemSize, @TFPSList_Sort_Comparer, @Context);
end;

SortingAlgorithm^.ItemListSorter_ContextComparer has type:
  TItemListSorter_Context = procedure(Items: Pointer; ItemCount, ItemSize: SizeUInt; Comparer: TListSortComparer_Context; Context: Pointer);

And so we can call this func with starting pointer, and count of items! It's possible to add SortRange. Can you add it, pls?
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-03-18 20:20 CudaText man New Issue
2020-03-20 14:32 Marco van de Voort Severity minor => feature
2020-03-20 14:32 Marco van de Voort FPCTarget => -