Ticket #3489: fix reloading of panelized file panel.

How to reproduce the bug:
1) Add something to 'Panelize'. It works with 'Find file' and 'External
   panelize' too.
2) Press C-o several (at least two) times (or run some console command).
3) Panel is now empty

  * (reload_panelized): always chdir to panel's cwd to refresh the VFS's cwd
before file list update.
  * (update_panels): change order of panel update: first update other panel,
then current one. Remove internal variable. Fix description.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2015-06-28 20:59:13 +03:00
parent d8c7f45c6f
commit 15bf7b4bbd

View File

@ -3933,10 +3933,10 @@ reload_panelized (WPanel * panel)
int i, j;
dir_list *list = &panel->dir;
if (panel != current_panel)
(void) mc_chdir (panel->cwd_vpath);
/* refresh current VFS directory required for vfs_path_from_str() */
(void) mc_chdir (panel->cwd_vpath);
for (i = 0, j = 0; i < panel->dir.len; i++)
for (i = 0, j = 0; i < list->len; i++)
{
vfs_path_t *vpath;
@ -4813,7 +4813,7 @@ remove_encoding_from_path (const vfs_path_t * vpath)
* If current_file == -1 then it automatically sets current_file and
* other_file to the currently selected files in the panels.
*
* if force_update has the UP_ONLY_CURRENT bit toggled on, then it
* If flags has the UP_ONLY_CURRENT bit toggled on, then it
* will not reload the other panel.
*
* @param flags for reload panel
@ -4823,12 +4823,13 @@ remove_encoding_from_path (const vfs_path_t * vpath)
void
update_panels (panel_update_flags_t flags, const char *current_file)
{
gboolean reload_other = (flags & UP_ONLY_CURRENT) == 0;
WPanel *panel;
update_one_panel (get_current_index (), flags, current_file);
if (reload_other)
/* first, update other panel... */
if ((flags & UP_ONLY_CURRENT) == 0)
update_one_panel (get_other_index (), flags, UP_KEEPSEL);
/* ...then current one */
update_one_panel (get_current_index (), flags, current_file);
if (get_current_type () == view_listing)
panel = PANEL (get_panel_widget (get_current_index ()));