Issue with TList<T>.Move
I discoved an issue with TList.Move, which occurs if the new Index is lower than the old one. I attached a demo project and here is a possible fix.
procedure TList<T>.Move(AIndex, ANewIndex: SizeInt);
var
lArr: TJSArray;
lCount: SizeInt;
lTemp: JSValue;
begin
if ANewIndex = AIndex then
Exit;
if (ANewIndex < 0) or (ANewIndex >= Count) then
raise EArgumentOutOfRangeException.Create(SArgumentOutOfRange);
lArr := TJSArray(FItems);
lTemp := lArr[AIndex];
if AIndex < ANewIndex then
begin
for lCount := AIndex to ANewIndex-1 do
lArr[lCount] := lArr[lCount + 1];
end
else
begin
for lCount := ANewIndex + 1 to AIndex do
lArr[lCount] := lArr[lCount - 1];
end;
lArr[ANewIndex] := lTemp;
end;