 src/ufileviewnotebook.pas | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/ufileviewnotebook.pas b/src/ufileviewnotebook.pas
index e639fa2c..88d85b0f 100644
--- a/src/ufileviewnotebook.pas
+++ b/src/ufileviewnotebook.pas
@@ -877,11 +877,19 @@ end;
 procedure TFileViewNotebook.DeletePage(Index: Integer);
 var
   APage: TFileViewPage;
+  I: Integer;
 begin
   APage:= GetPage(Index);
-  SetLength(FClosedPages, Length(FClosedPages) + 1);  // push
-  FClosedPages[High(FClosedPages)]:= APage;
-
+  if Length(FClosedPages) >= 10 then  // max undo pages count
+  begin
+    FClosedPages[0].Free;  // pop first
+    for I:= 0 to Length(FClosedPages) - 2 do  // move all left
+      FClosedPages[I]:= FClosedPages[I+1];
+    FClosedPages[High(FClosedPages)]:= APage;  // put last
+  end else begin
+    SetLength(FClosedPages, Length(FClosedPages) + 1);  // push
+    FClosedPages[High(FClosedPages)]:= APage;
+  end;
   FPageControl.Pages[Index].Free;
   //APage.Free;
 end;
