View Issue Details

IDProjectCategoryView StatusLast Update
0000250Double CommanderGraphical user interfacepublic2016-06-26 12:00
Reportervo.x Assigned Tocobines  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
ProjectionnoneETAnone 
Fixed in Version0.5.5 
Summary0000250: [patch] Make trasfer path feature bidirectional
DescriptionHello,

I was annoyed by the "transfer path" functionality, i.e. the Ctrl+{Left,Right} functionality, which differs from the behavior I was used to from TC or FC. The old functionality was like "Show the file list from active panel in inactive one, however if you want the list from inactive panel, you have to switch the panes first". The attached patch removes the latter limitation, i.e. you can get into active panel the file list from inactive panel.

If this patch is accepted (not sure if I used the best methods :)), I would like to see the cm_TargetEqualSource, cm_LeftEqualRight and cm_RightEqualLeft to be removed, since I am not aware any other commander uses such variety of commands and they are just confusing IMO. However this change is not contained in the patch yet.
TagsNo tags attached.
Attached Files
make-transfer-path-bidirectional.patch (4,271 bytes)   
Index: src/umaincommands.pas
===================================================================
--- src/umaincommands.pas	(revision 4102)
+++ src/umaincommands.pas	(working copy)
@@ -63,7 +63,7 @@
    procedure DoCopySelectedFileNamesToClipboard(FileView: TFileView; FullNames: Boolean);
    procedure DoNewTab(Notebook: TFileViewNotebook);
    procedure DoContextMenu(Panel: TFileView; X, Y: Integer; Background: Boolean);
-   procedure DoTransferPath(SourcePage: TFileViewPage; TargetPage: TFileViewPage);
+   procedure DoTransferPath(SourcePage: TFileViewPage; TargetPage: TFileViewPage; FromActivePanel: Boolean);
    procedure DoSortByFunctions(View: TFileView; FileFunctions: TFileFunctions);
    procedure DoShowMainMenu(bShow: Boolean);
    //---------------------
@@ -385,43 +385,51 @@
   end;
 end;
 
-procedure TMainCommands.DoTransferPath(SourcePage: TFileViewPage; TargetPage: TFileViewPage);
+procedure TMainCommands.DoTransferPath(SourcePage: TFileViewPage; TargetPage: TFileViewPage; FromActivePanel: Boolean);
 var
   aFile: TFile;
   NewPath: String;
 begin
-  aFile := SourcePage.FileView.CloneActiveFile;
-  if Assigned(aFile) then
-  try
-    if aFile.IsDirectory then
-    begin
-      if aFile.Name = '..' then
+  if FromActivePanel then
+  begin
+    aFile := SourcePage.FileView.CloneActiveFile;
+    if Assigned(aFile) then
+    try
+      if aFile.IsDirectory then
       begin
-        NewPath := GetParentDir(SourcePage.FileView.CurrentPath)
+        if aFile.Name = '..' then
+        begin
+          NewPath := GetParentDir(SourcePage.FileView.CurrentPath)
+        end
+        else
+        begin
+          // Change to a subdirectory.
+          NewPath := aFile.FullPath;
+        end;
+
+        if NewPath <> EmptyStr then
+          TargetPage.FileView.AddFileSource(SourcePage.FileView.FileSource, NewPath);
       end
       else
       begin
-        // Change to a subdirectory.
-        NewPath := aFile.FullPath;
+        // Change file source, if the file under cursor can be opened as another file source.
+        try
+          if not ChooseFileSource(TargetPage.FileView, aFile) then
+            TargetPage.FileView.AddFileSource(SourcePage.FileView.FileSource,
+                                              SourcePage.FileView.CurrentPath);
+        except
+          on e: EFileSourceException do
+            MessageDlg('Error', e.Message, mtError, [mbOK], 0);
+        end;
       end;
-
-      if NewPath <> EmptyStr then
-        TargetPage.FileView.AddFileSource(SourcePage.FileView.FileSource, NewPath);
-    end
-    else
-    begin
-      // Change file source, if the file under cursor can be opened as another file source.
-      try
-        if not ChooseFileSource(TargetPage.FileView, aFile) then
-          TargetPage.FileView.AddFileSource(SourcePage.FileView.FileSource,
-                                            SourcePage.FileView.CurrentPath);
-      except
-        on e: EFileSourceException do
-          MessageDlg('Error', e.Message, mtError, [mbOK], 0);
-      end;
+    finally
+      FreeAndNil(aFile);
     end;
-  finally
-    FreeAndNil(aFile);
+  end
+  else
+  begin
+    if SourcePage.FileView.CurrentPath <> EmptyStr then
+      TargetPage.FileView.AddFileSource(SourcePage.FileView.FileSource, SourcePage.FileView.CurrentPath);
   end;
 end;
 
@@ -814,16 +822,16 @@
 
 procedure TMainCommands.cm_TransferLeft(Param: String='');
 begin
-  if (frmMain.SelectedPanel = fpRight) then
-    DoTransferPath(frmMain.RightTabs.ActivePage,
-                   frmMain.LeftTabs.ActivePage);
+  DoTransferPath(frmMain.RightTabs.ActivePage,
+                 frmMain.LeftTabs.ActivePage,
+                 frmMain.SelectedPanel = fpRight);
 end;
 
 procedure TMainCommands.cm_TransferRight(Param: String='');
 begin
-  if (frmMain.SelectedPanel = fpLeft) then
-    DoTransferPath(frmMain.LeftTabs.ActivePage,
-                   frmMain.RightTabs.ActivePage);
+  DoTransferPath(frmMain.LeftTabs.ActivePage,
+                 frmMain.RightTabs.ActivePage,
+                 frmMain.SelectedPanel = fpLeft);
 end;
 
 procedure TMainCommands.cm_GoToFirstFile(Param: String='');
Fixed in Revision4142
Operating system
Widgetset
Architecture

Activities

vo.x

2011-11-20 01:45

reporter   ~0000156

Hm, watching the behavior of TC, the special handling of '..' should be probably disabled.

vo.x

2011-11-20 01:46

reporter   ~0000157

Better said, it should not change to the parent directory.

cobines

2011-11-22 10:19

administrator   ~0000176

It was actually requested.

We should distinguish between
a) clone all file sources and
b) change directory if file sources match or add file source from panel to another panel

Also should distinguish between
1) take current directory from panel and put it to another panel
2) take directory under cursor from panel and put it as current directory to another panel

Right now cm_TargetEqualSource, cm_LeftEqualRight, cm_RightEqualLeft do a) and cm_TransferLeft, cm_TransferRight do b2).

vo.x

2011-11-22 11:39

reporter   ~0000181

I can't believe it. It is so counterintuitive. You have to switch the panels all around (not mentioning there is some bug that the TAB stops working in some cases, but thats different story) if you want to get the opposite pane content into the current one. And thats often what I want. I open new tab and now I want to have opposite content in current panel, because I want to compare some files for example.

My point is that the current Ctrl+Right and Ctrl+Left has *no meaning*. There should be one shortcut for that not two. Because it always is "take directory from current panel and put it into the opposite one". The direction is irrelevant. I added the meaning to the direction.

cobines

2011-11-24 11:38

administrator   ~0000208

Maybe you should assign Ctrl+Left to cm_LeftEqualRight and Ctrl+Right to cm_RightEqualLeft then. Or do you want another command cm_SourceEqualTarget?

vo.x

2011-11-25 00:01

reporter   ~0000212

Yes, I was originally thinking about it, but then I found that is not the functionality I am used to from other commanders. Actually I did not changed the behavior of current Ctrl+Left/Right. I just added some meaning to unused part. So I would be surprised somebody can dislike the functionality.

cobines

2011-11-25 02:29

administrator   ~0000213

You also asked to remove the three other commands and not to transfer to parent directory when cursor is on "..". Is it not needed anymore?

vo.x

2011-11-25 02:39

reporter   ~0000214

Yes, I asked for them as a future possible extensions (or reductions in this case ;)), because they would simplify matters, but I would be OK even without them. Also note that the attached patch just "extends" and does not remove any functionality.

cobines

2011-11-26 09:54

administrator   ~0000215

OK, I thought the patch was supposed to replace them.

cobines

2011-12-07 14:04

administrator   ~0000263

Applied.

Issue History

Date Modified Username Field Change
2011-11-20 01:22 vo.x New Issue
2011-11-20 01:22 vo.x File Added: make-transfer-path-bidirectional.patch
2011-11-20 01:45 vo.x Note Added: 0000156
2011-11-20 01:46 vo.x Note Added: 0000157
2011-11-22 10:19 cobines Note Added: 0000176
2011-11-22 11:39 vo.x Note Added: 0000181
2011-11-24 11:38 cobines Note Added: 0000208
2011-11-25 00:01 vo.x Note Added: 0000212
2011-11-25 02:29 cobines Note Added: 0000213
2011-11-25 02:39 vo.x Note Added: 0000214
2011-11-26 09:54 cobines Note Added: 0000215
2011-12-07 14:04 cobines Fixed in Revision => 4142
2011-12-07 14:04 cobines Note Added: 0000263
2011-12-07 14:04 cobines Status new => resolved
2011-12-07 14:04 cobines Fixed in Version => 0.5.5
2011-12-07 14:04 cobines Resolution open => fixed
2011-12-07 14:04 cobines Assigned To => cobines
2016-06-26 12:00 Alexx2000 Status resolved => closed