View Issue Details

IDProjectCategoryView StatusLast Update
0036802FPCRTLpublic2020-03-20 14:32
ReporterCudaText man Assigned To 
Status newResolutionopen 
Product Version3.3.1 
Summary0036802: Request: fgl TFPSList.SortRange
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);
  Context: TFPSList_Sort_Comparer_Context;
  Context.Compare := Compare;
  SortingAlgorithm^.ItemListSorter_ContextComparer(FList, FCount, FItemSize, @TFPSList_Sort_Comparer, @Context);

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
Attached Files


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 => -