Browse Source

Fix FV history list

Margers 9 months ago
parent
commit
4c4388f830
1 changed files with 4 additions and 4 deletions
  1. 4 4
      packages/fv/src/histlist.inc

+ 4 - 4
packages/fv/src/histlist.inc

@@ -371,13 +371,13 @@ BEGIN
   StrU8 := Str;
   while (HistoryUsed+Length(StrU8)+EncodedSizeLengthInBytes(Length(StrU8))+2>HistorySize) do
    begin
-       P:=HistoryBlock;
+       P:=HistoryBlock+1;
        while Pointer(P)<Pointer(HistoryBlock)+HistorySize do
          begin
            if Pointer(P)+StoredStringSize(P+2)+4+Length(StrU8)+EncodedSizeLengthInBytes(Length(StrU8)) >
               Pointer(HistoryBlock)+HistorySize then
              begin
-               Dec(HistoryUsed,Length(PShortString(P+2)^)+3);
+               HistoryUsed:=P-HistoryBlock;
                FillChar(P^,Pointer(HistoryBlock)+HistorySize-Pointer(P),#0);
                break;
              end;
@@ -403,13 +403,13 @@ VAR P, P1, P2: PAnsiChar;
 BEGIN
   while (HistoryUsed+Length(Str)+3>HistorySize) do
    begin
-       P:=PAnsiChar(HistoryBlock);
+       P:=PAnsiChar(HistoryBlock)+1;
        while Pointer(P)<Pointer(HistoryBlock)+HistorySize do
          begin
            if Pointer(P)+Length(PShortString(P+2)^)+6+Length(Str) >
               Pointer(HistoryBlock)+HistorySize then
              begin
-               Dec(HistoryUsed,Length(PShortString(P+2)^)+3);
+               HistoryUsed:=P-HistoryBlock;
                FillChar(P^,Pointer(HistoryBlock)+HistorySize-Pointer(P),#0);
                break;
              end;