Index: newdesign/ufileview.pas
===================================================================
--- newdesign/ufileview.pas	(revision 4390)
+++ newdesign/ufileview.pas	(working copy)
@@ -187,6 +187,7 @@
     }
     procedure BeforeMakeFileList; virtual;
     procedure ChooseFile(const AFile: TDisplayFile; FolderMode: Boolean = False); virtual;
+    procedure ClearFiles; virtual;
     procedure DoUpdateView; virtual;
     {en
        Returns current work type in progress.
@@ -1076,13 +1077,7 @@
 
   if gListFilesInThread then
   begin
-    // Clear files.
-    if Assigned(FAllDisplayFiles) then
-    begin
-      FFiles.Clear;
-      FAllDisplayFiles.Clear; // Clear references to files from the source.
-    end;
-
+    ClearFiles;
     BeforeMakeFileList;
     AThread.QueueFunction(@Worker.StartParam);
   end
@@ -1130,6 +1125,16 @@
   end;
 end;
 
+procedure TFileView.ClearFiles;
+begin
+  // Clear files.
+  if Assigned(FAllDisplayFiles) then
+  begin
+    FFiles.Clear;
+    FAllDisplayFiles.Clear; // Clear references to files from the source.
+  end;
+end;
+
 procedure TFileView.DoUpdateView;
 begin
   // Empty.
@@ -2028,4 +2033,4 @@
 end;
 
 end.
-+
Index: newdesign/ucolumnsfileview.pas
===================================================================
--- newdesign/ucolumnsfileview.pas	(revision 4398)
+++ newdesign/ucolumnsfileview.pas	(working copy)
@@ -139,6 +139,7 @@
     FUpdatingGrid: Boolean;
     FLastSelectionStartRow: Integer;
     FLastSelectionState: Boolean;
+    FInputLocked: Boolean; // To prevent file list blinking we don't clear the files but instead prevent user input
 
     pnlFooter: TPanel;
     lblInfo: TLabel;
@@ -288,6 +289,7 @@
 
     procedure BeforeMakeFileList; override;
     procedure AfterMakeFileList; override;
+    procedure ClearFiles; override;
     procedure DoUpdateView; override;
     {en
        Changes drawing colors depending on if this panel is active.
@@ -635,7 +637,7 @@
   iRow, iCol : Integer;
   AFile: TDisplayFile;
 begin
-  if (Y < dgPanel.GetHeaderHeight) then Exit; // if is header
+  if (Y < dgPanel.GetHeaderHeight) or FInputLocked then Exit; // if is header or locked
 
   SetFocus;
 
@@ -802,6 +804,9 @@
   MI:TMenuItem;
   Background: Boolean;
 begin
+  if FInputLocked then
+    Exit;
+
   if Button = mbRight then
     begin
       { If right click on header }
@@ -877,7 +882,7 @@
 begin
   Accept := False;
 
-  if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) then
+  if (not (Source is TDrawGridEx)) or (not (Sender is TDrawGridEx)) or FInputLocked then
     Exit;
 
   // Always allow dropping into an empty panel.
@@ -1009,7 +1014,7 @@
   ShiftState : TShiftState;
   SortingDirection : TSortDirection = sdAscending;
 begin
-  if not IsColumn then Exit;
+  if not IsColumn or FInputLocked then Exit;
 
   ShiftState := GetKeyShiftState;
   if not ((ssShift in ShiftState) or (ssCtrl in ShiftState)) then
@@ -1034,14 +1039,17 @@
   I: Integer;
 begin
   Handled:= True;
-  case gScrollMode of
-  smLineByLine:
-    for I:= 1 to gWheelScrollLines do
-    dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0);
-  smPageByPage:
-    dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0);
-  else
-    Handled:= False;
+  if not FInputLocked then
+  begin
+    case gScrollMode of
+    smLineByLine:
+      for I:= 1 to gWheelScrollLines do
+      dgPanel.Perform(LM_VSCROLL, SB_LINEUP, 0);
+    smPageByPage:
+      dgPanel.Perform(LM_VSCROLL, SB_PAGEUP, 0);
+    else
+      Handled:= False;
+    end;
   end;
 end;
 
@@ -1051,14 +1059,17 @@
   I: Integer;
 begin
   Handled:= True;
-  case gScrollMode of
-  smLineByLine:
-    for I:= 1 to gWheelScrollLines do
-    dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0);
-  smPageByPage:
-    dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0);
-  else
-    Handled:= False;
+  if not FInputLocked then
+  begin
+    case gScrollMode of
+    smLineByLine:
+      for I:= 1 to gWheelScrollLines do
+      dgPanel.Perform(LM_VSCROLL, SB_LINEDOWN, 0);
+    smPageByPage:
+      dgPanel.Perform(LM_VSCROLL, SB_PAGEDOWN, 0);
+    else
+      Handled:= False;
+    end;
   end;
 end;
 
@@ -1092,7 +1103,7 @@
   AFile: TDisplayFile;
   sHint: UTF8String;
 begin
-  if HintInfo^.HintStr = EmptyStr then Exit; // don't show
+  if (HintInfo^.HintStr = EmptyStr) or FInputLocked then Exit; // don't show
 
   with dgPanel do
   begin
@@ -1169,12 +1180,15 @@
 
 procedure TColumnsFileView.AfterChangePath;
 begin
-  FUpdatingGrid := True;
-  dgPanel.Row := 0;
-  FUpdatingGrid := False;
-
   inherited AfterChangePath;
 
+  if not FInputLocked then
+  begin
+    FUpdatingGrid := True;
+    dgPanel.Row := 0;
+    FUpdatingGrid := False;
+  end;
+
   pnlHeader.UpdatePathLabel;
 end;
 
@@ -1951,6 +1965,24 @@
   aFile: TDisplayFile;
   mi: TMenuItem;
 begin
+  if FInputLocked then
+    case Key of
+      VK_BACK:
+        begin
+          ChangePathToParent(True);
+          Key := 0;
+        end;
+      VK_ESCAPE:
+        if GetCurrentWorkType <> fvwtNone then
+          begin
+            StopWorkers;
+            inherited ClearFiles;
+            Key := 0;
+          end;
+      else
+        Key := 0;
+    end;
+
   // check if ShiftState is equal to quick search / filter modes
   if quickSearch.CheckSearchOrFilter(Key) then
     Exit;
@@ -2168,7 +2200,8 @@
 
 procedure TColumnsFileView.lblFilterClick(Sender: TObject);
 begin
-  quickSearch.Initialize(qsFilter);
+  if not FInputLocked then
+    quickSearch.Initialize(qsFilter);
 end;
 
 procedure TColumnsFileView.ColumnsMenuClick(Sender: TObject);
@@ -2450,18 +2483,36 @@
   EnsureDisplayProperties; // After displaying.
 end;
 
+procedure TColumnsFileView.ClearFiles;
+begin
+  // Don't clear files. Lock input instead.
+  FInputLocked := True;
+end;
+
 procedure TColumnsFileView.DisplayFileListHasChanged;
+var
+  NewRowSet: Boolean = False;
 begin
   // Update grid row count.
   SetRowCount(FFiles.Count);
   RedrawGrid;
 
   if SetActiveFileNow(RequestedActiveFile) then
-    RequestedActiveFile := ''
+  begin
+    RequestedActiveFile := '';
+    NewRowSet := True;
+  end
   else
     // Requested file was not found, restore position to last active file.
-    SetActiveFileNow(LastActiveFile);
+    NewRowSet := SetActiveFileNow(LastActiveFile);
 
+  if not NewRowSet and FInputLocked then
+  begin
+    FUpdatingGrid := True;
+    dgPanel.Row := 0;
+    FUpdatingGrid := False;
+  end;
+
   UpdateInfoPanel;
 end;
 
@@ -2655,6 +2706,7 @@
   end;
   dgPanel.Cursor := crDefault;
   UpdateInfoPanel;
+  FInputLocked := False;
 end;
 
 procedure TColumnsFileView.DoUpdateView;
@@ -2774,8 +2826,8 @@
 procedure TColumnsFileView.UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
 begin
   // check if ShiftState is equal to quick search / filter modes
-  if quickSearch.CheckSearchOrFilter(UTF8Key) then
-    Exit;
+  if not FInputLocked then
+    quickSearch.CheckSearchOrFilter(UTF8Key);
 end;
 
 procedure TColumnsFileView.DoDragDropOperation(Operation: TDragDropOperation;
@@ -2826,51 +2878,61 @@
 
 procedure TColumnsFileView.cm_MarkInvert(param: string='');
 begin
-  InvertAll;
+  if not FInputLocked then
+    InvertAll;
 end;
 
 procedure TColumnsFileView.cm_MarkMarkAll(param: string='');
 begin
-  MarkAll;
+  if not FInputLocked then
+    MarkAll;
 end;
 
 procedure TColumnsFileView.cm_MarkUnmarkAll(param: string='');
 begin
-  UnMarkAll;
+  if not FInputLocked then
+    UnMarkAll;
 end;
 
 procedure TColumnsFileView.cm_MarkPlus(param: string='');
 begin
-  MarkPlus;
+  if not FInputLocked then
+    MarkPlus;
 end;
 
 procedure TColumnsFileView.cm_MarkMinus(param: string='');
 begin
-  MarkMinus;
+  if not FInputLocked then
+    MarkMinus;
 end;
 
 procedure TColumnsFileView.cm_MarkCurrentExtension(param: string='');
 begin
-  MarkShiftPlus;
+  if not FInputLocked then
+    MarkShiftPlus;
 end;
 
 procedure TColumnsFileView.cm_UnmarkCurrentExtension(param: string='');
 begin
-  MarkShiftMinus;
+  if not FInputLocked then
+    MarkShiftMinus;
 end;
 
 procedure TColumnsFileView.cm_SaveSelection(param: string);
 begin
-  SaveSelection;
+  if not FInputLocked then
+    SaveSelection;
 end;
 
 procedure TColumnsFileView.cm_RestoreSelection(param: string);
 begin
-  RestoreSelection;
+  if not FInputLocked then
+    RestoreSelection;
 end;
 
 procedure TColumnsFileView.cm_SaveSelectionToFile(param: string);
 begin
+  if not FInputLocked then
   with dmComData do
   begin
     SaveDialog.DefaultExt:= '.txt';
@@ -2889,6 +2951,7 @@
 
 procedure TColumnsFileView.cm_LoadSelectionFromFile(param: string);
 begin
+  if not FInputLocked then
   with dmComData do
   begin
     OpenDialog.DefaultExt:= '.txt';
@@ -2907,8 +2970,11 @@
 
 procedure TColumnsFileView.cm_LoadSelectionFromClip(param: string);
 begin
-  FSavedSelection.Text:= Clipboard.AsText;
-  RestoreSelection;
+  if not FInputLocked then
+  begin
+    FSavedSelection.Text:= Clipboard.AsText;
+    RestoreSelection;
+  end;
 end;
 
 {
@@ -2921,10 +2987,13 @@
 }
 procedure TColumnsFileView.cm_QuickSearch(param: string='');
 begin
-  if param = EmptyStr then
-    quickSearch.Initialize(qsSearch)
-  else
-    quickSearch.ToggleOption(param);
+  if not FInputLocked then
+  begin
+    if param = EmptyStr then
+      quickSearch.Initialize(qsSearch)
+    else
+      quickSearch.ToggleOption(param);
+  end;
 end;
 
 {
@@ -2937,27 +3006,32 @@
 }
 procedure TColumnsFileView.cm_QuickFilter(param: string='');
 begin
-  if param = EmptyStr then
-    quickSearch.Initialize(qsFilter)
-  else
-    quickSearch.ToggleOption(param);
+  if not FInputLocked then
+  begin
+    if param = EmptyStr then
+      quickSearch.Initialize(qsFilter)
+    else
+      quickSearch.ToggleOption(param);
+  end;
 end;
 
 procedure TColumnsFileView.cm_Open(param: string='');
 begin
-  ChooseFile(GetActiveDisplayFile);
+  if not FInputLocked then
+    ChooseFile(GetActiveDisplayFile);
 end;
 
 procedure TColumnsFileView.cm_CountDirContent(param: string='');
 begin
-  CalculateSpaceOfAllDirectories;
+  if not FInputLocked then
+    CalculateSpaceOfAllDirectories;
 end;
 
 procedure TColumnsFileView.cm_RenameOnly(param: string='');
 var
   aFile: TFile;
 begin
-  if (fsoSetFileProperty in FileSource.GetOperationsTypes) then
+  if (fsoSetFileProperty in FileSource.GetOperationsTypes) and not FInputLocked then
     begin
       aFile:= CloneActiveFile;
       if Assigned(aFile) then
@@ -2977,11 +3051,14 @@
   Rect: TRect;
   Point: TPoint;
 begin
-  Rect := dgPanel.CellRect(0, dgPanel.Row);
-  Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2);
-  Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2);
-  Point := dgPanel.ClientToScreen(Point);
-  frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False);
+  if not FInputLocked then
+  begin
+    Rect := dgPanel.CellRect(0, dgPanel.Row);
+    Point.X := Rect.Left + ((Rect.Right - Rect.Left) div 2);
+    Point.Y := Rect.Top + ((Rect.Bottom - Rect.Top) div 2);
+    Point := dgPanel.ClientToScreen(Point);
+    frmMain.Commands.DoContextMenu(Self, Point.X, Point.Y, False);
+  end;
 end;
 
 procedure TColumnsFileView.cm_EditPath(param: string);
@@ -2991,12 +3068,14 @@
 
 procedure TColumnsFileView.cm_GoToFirstFile(param: string);
 begin
-  dgPanel.Row:= dgPanel.FixedRows;
+  if not FInputLocked then
+    dgPanel.Row:= dgPanel.FixedRows;
 end;
 
 procedure TColumnsFileView.cm_GoToLastFile(param: string);
 begin
-  dgPanel.Row:= dgPanel.RowCount - 1;
+  if not FInputLocked then
+    dgPanel.Row:= dgPanel.RowCount - 1;
 end;
 
 { TDrawGridEx }
@@ -3419,7 +3498,8 @@
 
   if gdFixed in aState then
   begin
-    DrawFixed  // Draw column headers
+    DrawFixed;  // Draw column headers
+    DrawCellGrid(aCol,aRow,aRect,aState);
   end
   else if ColumnsView.FFiles.Count > 0 then
   begin
@@ -3434,10 +3514,15 @@
       DrawIconCell  // Draw icon in the first column
     else
       DrawOtherCell;
-  end;
 
     DrawCellGrid(aCol,aRow,aRect,aState);
     DrawLines;
+  end
+  else
+  begin
+    Canvas.Brush.Color := Self.Color;
+    Canvas.FillRect(aRect);
+  end;
 end;
 
 procedure TDrawGridEx.MouseMove(Shift: TShiftState; X, Y: Integer);
@@ -3573,6 +3658,8 @@
   // doubleclick events we have to also drop MouseDown events that precede them.
   if TooManyDoubleClicks then Exit;
 {$ENDIF}
+  if ColumnsView.FInputLocked then
+    Exit;
 
   FMouseDown := True;
 
