On closer inspection, saving and retrieving this_dir is a simple
hack to setup.c, setup.h, and main.c. The real issue is what to do
at startup.
In midnight.c:create_panels() around line 600, if command line
arguments run_param0 and run_param1 are both NULL we assume
this_panel (active panel) is the current directory, and that's the
way it works. There is no check for auto_save_panels, and if so,
restore the active saved directory.
This works to fix the issue:
[code]
if (boot_current_is_left)
{
/* left panel is active */
current_index = 0;
other_index = 1;
current_mode = startup_left_mode;
other_mode = startup_right_mode;
if (mc_run_param0 == NULL && mc_run_param1 ==
NULL)
{
/* no arguments */
if (panels_options.auto_save_setup) { /* check if we
should restore active panel */
current_dir = saved_this_dir;
} else {
current_dir = NULL; /* assume current dir */
}
other_dir = saved_other_dir; /* from ini */
}
else if (mc_run_param0 != NULL && mc_run_param1 !=
NULL)
{
/* two arguments */
current_dir = (char *) mc_run_param0;
other_dir = mc_run_param1;
}
else /* mc_run_param0 != NULL
&& mc_run_param1 == NULL */
{
/* one argument */
current_dir = (char *) mc_run_param0;
other_dir = saved_other_dir; /* from ini */
}
}
else
{
/* right panel is active */
current_index = 1;
other_index = 0;
current_mode = startup_right_mode;
other_mode = startup_left_mode;
if (mc_run_param0 == NULL && mc_run_param1 ==
NULL)
{
/* no arguments */
if (panels_options.auto_save_setup) {
current_dir = saved_this_dir;
} else {
current_dir = NULL; /* assume current dir */
}
other_dir = saved_other_dir; /* from ini */
}
else if (mc_run_param0 != NULL && mc_run_param1 !=
NULL)
{
/* two arguments */
current_dir = (char *) mc_run_param0;
other_dir = mc_run_param1;
}
else /* mc_run_param0 != NULL
&& mc_run_param1 == NULL */
{
/* one argument */
current_dir = (char *) mc_run_param0;
other_dir = saved_other_dir; /* from ini */
}
}
[/code]
I can put it all together as a patch and post it if you like.
Minor modifications to 4 files.
On 2016-10-07 07:03, Mike wrote:
Isn't that what F9 -> Options -> panel options -> auto
save panels setup is for?
I believe OP is correct: mc forgets the active directory if you do
have "auto save panels setup" selected.
$HOME/.config/mc/panels.ini:
[Dirs]
other_dir=/some/dir/somewhere
current_is_left=false
I think this file should be saved with:
this_dir=/some/dir
?
Whichever panel is active on shutdown, gets set back to $HOME
on restart. This is not correct.
From a cursory look, it's a simple hack to setup.c. I guess it
got overlooked because few people use that option.
On 2016-10-07 05:39, chris glur
wrote:
Also it doesn't remember the active panel on last
close was the right panel.
When, as usual, I've got several mc running: they all initially start with
the latest <save setup> conditions.
If I rarely, change the format-order of a mc, I don't want that new specail
setting to be remembered and REPLACE my chosen default settings.
You seems to write as if you had onlu one mc running?
_______________________________________________
mc mailing list
https://mail.gnome.org/mailman/listinfo/mc
--
Peace and Cheer
--
Peace and Cheer