Ticket #2783: when right panel is active, panel paths are swapped at each mc start.

How to reproduce.
1. Goto ~. Run mc. Enable autosave panels setup before exit. Save options.
2.  Open ~ dir in the left panel, / in the right one. Make right panel active.
3. Close mc.
4. With mc-wrapper, following is performed:
4.1. Run mc. Now ~ in the right panel, / in the left one.
4.2. Close mc.
4.3. Run mc. Now ~ in the left panel again, / in the right one.
4.4. ...and so on.
5. Without mc-wrapper, following is performed:
5.1. Run mc. Now ~ in both panels.

Expected behavior with current_is_left=false

1. if mc start as mc dir dir2, dir1 is opened in the left panel, dir2 in
the right one.
2. if mc starts as mc (without dir1 and dir2), active (right)  panel
contains working directory, other (left) one contains other_dir from
panel.ini.
3. if mc start as mc dir1, dir1 is opened in the left panel, right panel
contains working directory.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-05-01 15:58:09 +04:00
parent de812a639c
commit cb261be463
2 changed files with 22 additions and 4 deletions

View File

@ -579,7 +579,10 @@ create_panels (void)
other_index = 1;
current_mode = startup_left_mode;
other_mode = startup_right_mode;
/* if mc_run_param0 is NULL, working directory will be used for the left panel */
current_dir = mc_run_param0;
/* mc_run_param1 is never NULL. It is setup from command line or from panels.ini
* (value of other_dir). mc_run_param1 will be used for the right panel */
other_dir = mc_run_param1;
}
else
@ -589,8 +592,21 @@ create_panels (void)
other_index = 0;
current_mode = startup_right_mode;
other_mode = startup_left_mode;
current_dir = mc_run_param1;
other_dir = mc_run_param0;
/* if mc_run_param0 is not NULL (it was setup from command line), it will be used
* for the left panel, working directory will be used for the right one;
* if mc_run_param0 is NULL, working directory will be used for the right (active) panel,
* mc_run_param1 will be used for the left one */
if (mc_run_param0 != NULL)
{
current_dir = NULL;
other_dir = mc_run_param0;
}
else
{
current_dir = NULL;
other_dir = mc_run_param1;
}
}
/* 1. Get current dir */
@ -609,7 +625,10 @@ create_panels (void)
/* 3. Create active panel */
if (current_dir == NULL)
{
current_dir = vfs_path_to_str (original_dir);
mc_chdir (original_dir);
}
else
{
vfs_path_t *vpath;

View File

@ -799,8 +799,7 @@ save_panel_types (void)
}
if (current_panel != NULL)
mc_config_set_string (mc_panels_config, "Dirs", "current_is_left",
get_current_index () == 0 ? "1" : "0");
mc_config_set_bool (mc_panels_config, "Dirs", "current_is_left", get_current_index () == 0);
if (mc_panels_config->ini_path == NULL)
mc_panels_config->ini_path = g_strdup (panels_profile_name);