2
0
Эх сурвалжийг харах

FIX: Disable FlatView on FileSource change
FIX: Open in new tab '..' item

Alexander Koblov 11 жил өмнө
parent
commit
5d80b9bf88

+ 3 - 0
src/fileviews/ufileview.pas

@@ -2655,6 +2655,8 @@ begin
 
   if BeforeChangePath(aFileSource, aPath) then
   begin
+    FFlatView := False;
+
     if Assigned(FileSource) and IsNewFileSource then
       FileSource.RemoveReloadEventListener(@ReloadEvent);
 
@@ -2688,6 +2690,7 @@ var
 begin
   if FileSourcesCount > 0 then
   begin
+    FFlatView := False;
     // TODO: Do this by remembering focused file name in a list?
     FocusedFile := ExtractFileName(FileSource.CurrentAddress);
 

+ 28 - 25
src/umaincommands.pas

@@ -781,47 +781,50 @@ end;
 
 procedure TMainCommands.cm_OpenDirInNewTab(const Params: array of string);
 
-  procedure OpenTab(const aFullPath: string);
-  var
-    NewPage: TFileViewPage;
+  function OpenTab(const aFullPath: string): TFileViewPage;
   begin
-    NewPage := FrmMain.ActiveNotebook.NewPage(FrmMain.ActiveFrame);
+    Result := FrmMain.ActiveNotebook.NewPage(FrmMain.ActiveFrame);
     // Workaround for Search Result File Source
-    if NewPage.FileView.FileSource is TSearchResultFileSource then
-      SetFileSystemPath(NewPage.FileView, aFullPath)
+    if Result.FileView.FileSource is TSearchResultFileSource then
+      SetFileSystemPath(Result.FileView, aFullPath)
     else
-      NewPage.FileView.CurrentPath := aFullPath;
-    if tb_open_new_in_foreground in gDirTabOptions then
-      NewPage.MakeActive;
+      Result.FileView.CurrentPath := aFullPath;
   end;
 
-  procedure OpenArchive(const aFile: TFile);
-  var
-    NewPage: TFileViewPage;
+  function OpenArchive(const aFile: TFile): TFileViewPage;
+  begin
+    Result := FrmMain.ActiveNotebook.NewPage(FrmMain.ActiveFrame);
+    ChooseArchive(Result.FileView, aFile);
+  end;
+
+  function OpenParent: TFileViewPage;
   begin
-    NewPage := FrmMain.ActiveNotebook.NewPage(FrmMain.ActiveFrame);
-    ChooseArchive(NewPage.FileView, aFile);
-    if tb_open_new_in_foreground in gDirTabOptions then
-      NewPage.MakeActive;
+    Result := FrmMain.ActiveNotebook.NewPage(FrmMain.ActiveFrame);
+    Result.FileView.ChangePathToParent(True);
   end;
 
 var
   aFile: TFile;
+  NewPage: TFileViewPage;
 begin
   aFile := FrmMain.ActiveFrame.CloneActiveFile;
-  if Assigned(aFile) then
-  try
-    if aFile.IsNameValid and (aFile.IsDirectory or aFile.IsLinkToDirectory) then
-      OpenTab(aFile.FullPath)
+  if not Assigned(aFile) then
+    NewPage := OpenTab(FrmMain.ActiveFrame.CurrentPath)
+  else try
+    if not aFile.IsNameValid then
+      NewPage := OpenParent
+    else if (aFile.IsDirectory or aFile.IsLinkToDirectory) then
+      NewPage := OpenTab(aFile.FullPath)
     else if FileIsArchive(aFile.FullPath) then
-      OpenArchive(aFile)
+      NewPage := OpenArchive(aFile)
     else
-      OpenTab(FrmMain.ActiveFrame.CurrentPath);
+      NewPage := OpenTab(aFile.Path);
   finally
     FreeAndNil(aFile);
-  end
-  else
-    OpenTab(FrmMain.ActiveFrame.CurrentPath);
+  end;
+
+  if tb_open_new_in_foreground in gDirTabOptions then
+    NewPage.MakeActive;
 end;
 
 procedure TMainCommands.cm_TargetEqualSource(const Params: array of string);