mc startup with single specified path



Hello.

I'm having some puzzlement over the initial startup behavior of mc-4.8.10 when paths are specified on the command line.

To quote the manual:

[quote]
If both paths are specified, the first path name is the directory to show in the left panel; the second path name is the directory to be
       shown in the right panel.

If one path is specified, the path name is the directory to show in the
       active panel; current directory is shown in the passive panel.

If no paths are specified, current directory is shown in the active panel; value of "other_dir" from panels.ini is the directory to be
       shown in the passive panel.
[/quote]

Paragraph #1:
This seems correct and intuitive.

Paragraph #2:
What I *expect* to happen when I specify only one path on the command line, is for that directory to appear in the left panel with the focus on it. As it works right now, it appears to be random which panel it shows up in, and which panel has focus. I know that it depends on the last time I hit "Save Setup" and the setting of current_is_left in panels.ini, but it always seems to do the wrong thing. As a matter of fact, the behavior I'm witnessing, is that that specified directory appears in the *inactive* panel, and the CWD appears in the *active* panel. I think that is counter-intuitive, a bit annoying, and exactly *not* what the manual says.

Paragraph #3:
This also seems correct and intuitive. Resort to default behavior if nothing is specified.

---

I believe the issue is in midnight.c, static void create_panels(), around lines 619-624 and 646-651, both bits are identical, and they shouldn't be:
[code]
else /* mc_run_param0 != NULL && mc_run_param1 == NULL */
        {
            /* one argument */
            current_dir = NULL; /* assume current dir */
            other_dir = (char *) mc_run_param0;
        }
[/code]
Is it just me, or does this seem *exactly* backwards?

I've changed these bits like this (the 1st is when the left panel is active):

[code]
--- midnight.c~ 2013-08-02 11:02:40.000000000 -0700
+++ midnight.c  2013-10-16 13:59:48.541659334 -0700
@@ -619,8 +619,8 @@ create_panels (void)
else /* mc_run_param0 != NULL && mc_run_param1 == NULL */
         {
             /* one argument */
-            current_dir = NULL; /* assume current dir */
-            other_dir = (char *) mc_run_param0; /* Wrong. */
+ current_dir = (char *) mc_run_param0; /* Left panel gets the path */
+            other_dir = NULL; /* assume other dir */
         }
     }
     else
@@ -648,6 +648,7 @@ create_panels (void)
             /* one argument */
             current_dir = NULL; /* assume current dir */ ;
other_dir = (char *) mc_run_param0; /* Left panel gets the path */ + boot_current_is_left = TRUE; /* make left panel active (user called it, there must be a reason.) */
         }
     }
[/code]

and it now behaves the way I would expect.

After doing a bit more research, it looks as if create_panels() was freshly re-written for 4.8.10. In 4.8.9 I see this bit:
[code]
        if (mc_run_param0 != NULL)
        {
            current_dir = NULL;
            other_dir = (char *) mc_run_param0;
        }
        else
        {
            current_dir = NULL;
            other_dir = mc_run_param1;
        }
[/code]
Hmmm... Is it even possible to have mc_run_param1 *without* mc_run_param0? Also, what if both are set? No wonder it got re-written.

--
Peace and Cheer


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]