WPanel: rename 'selected' to 'current' and related changes.

Renames:
  WPanel::selected -> WPanel::current
  selection (macro) -> panel_current_entry()
  panel_selected_at_half() -> panel_current_at_half()
  move_selection() -> panel_move_current()
  do_select() -> panel_set_current()
  try_to_select() -> panel_set_current_by_name()
  mark_if_marking(): argument and intermal variables
  file attributes:
    SELECTED -> CURRENT
    MARKED_SELECTED -> MARKED_CURRENT

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-04-15 14:05:38 +03:00
parent fac7922cd0
commit f29118dcec
17 changed files with 277 additions and 222 deletions

View File

@ -3534,26 +3534,28 @@ dview_diff_cmd (const void *f0, const void *f1)
/* run from panels */ /* run from panels */
const WPanel *panel0 = (const WPanel *) f0; const WPanel *panel0 = (const WPanel *) f0;
const WPanel *panel1 = (const WPanel *) f1; const WPanel *panel1 = (const WPanel *) f1;
const file_entry_t *fe0;
const file_entry_t *fe1;
fe0 = panel_current_entry (panel0);
file0 = file0 =
vfs_path_append_new (panel0->cwd_vpath, selection (panel0)->fname->str, vfs_path_append_new (panel0->cwd_vpath, fe0->fname->str, (char *) NULL);
(char *) NULL); is_dir0 = S_ISDIR (fe0->st.st_mode);
is_dir0 = S_ISDIR (selection (panel0)->st.st_mode);
if (is_dir0) if (is_dir0)
{ {
message (D_ERROR, MSG_ERROR, _("\"%s\" is a directory"), message (D_ERROR, MSG_ERROR, _("\"%s\" is a directory"),
path_trunc (selection (panel0)->fname->str, 30)); path_trunc (fe0->fname->str, 30));
goto ret; goto ret;
} }
fe1 = panel_current_entry (panel1);
file1 = file1 =
vfs_path_append_new (panel1->cwd_vpath, selection (panel1)->fname->str, vfs_path_append_new (panel1->cwd_vpath, fe1->fname->str, (char *) NULL);
(char *) NULL); is_dir1 = S_ISDIR (fe1->st.st_mode);
is_dir1 = S_ISDIR (selection (panel1)->st.st_mode);
if (is_dir1) if (is_dir1)
{ {
message (D_ERROR, MSG_ERROR, _("\"%s\" is a directory"), message (D_ERROR, MSG_ERROR, _("\"%s\" is a directory"),
path_trunc (selection (panel1)->fname->str, 30)); path_trunc (fe1->fname->str, 30));
goto ret; goto ret;
} }
break; break;

View File

@ -1021,7 +1021,7 @@ advanced_chown_cmd (WPanel * panel)
if (panel->marked != 0) if (panel->marked != 0)
fname = next_file (panel); /* next marked file */ fname = next_file (panel); /* next marked file */
else else
fname = selection (panel)->fname; /* single file */ fname = panel_current_entry (panel)->fname; /* single file */
vpath = vfs_path_from_str (fname->str); vpath = vfs_path_from_str (fname->str);

View File

@ -1234,7 +1234,7 @@ chattr_cmd (WPanel * panel)
if (panel->marked != 0) if (panel->marked != 0)
fname = next_file (panel); /* next marked file */ fname = next_file (panel); /* next marked file */
else else
fname = selection (panel)->fname; /* single file */ fname = panel_current_entry (panel)->fname; /* single file */
vpath = vfs_path_from_str (fname->str); vpath = vfs_path_from_str (fname->str);

View File

@ -554,7 +554,7 @@ chmod_cmd (WPanel * panel)
if (panel->marked != 0) if (panel->marked != 0)
fname = next_file (panel); /* next marked file */ fname = next_file (panel); /* next marked file */
else else
fname = selection (panel)->fname; /* single file */ fname = panel_current_entry (panel)->fname; /* single file */
vpath = vfs_path_from_str (fname->str); vpath = vfs_path_from_str (fname->str);

View File

@ -423,7 +423,7 @@ chown_cmd (WPanel * panel)
if (panel->marked != 0) if (panel->marked != 0)
fname = next_file (panel); /* next marked file */ fname = next_file (panel); /* next marked file */
else else
fname = selection (panel)->fname; /* single file */ fname = panel_current_entry (panel)->fname; /* single file */
vpath = vfs_path_from_str (fname->str); vpath = vfs_path_from_str (fname->str);

View File

@ -125,14 +125,18 @@ static const char *machine_str = N_("Enter machine name (F1 for details):");
/*** file scope functions ************************************************************************/ /*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** /**
* Run viewer (internal or external) on the currently selected file. * Run viewer (internal or external) on the current file.
* If @plain_view is TRUE, force internal viewer and raw mode (used for F13). * If @plain_view is TRUE, force internal viewer and raw mode (used for F13).
*/ */
static void static void
do_view_cmd (WPanel * panel, gboolean plain_view) do_view_cmd (WPanel * panel, gboolean plain_view)
{ {
const file_entry_t *fe;
fe = panel_current_entry (panel);
/* Directories are viewed by changing to them */ /* Directories are viewed by changing to them */
if (S_ISDIR (selection (panel)->st.st_mode) || link_isdir (selection (panel))) if (S_ISDIR (fe->st.st_mode) || link_isdir (fe))
{ {
vfs_path_t *fname_vpath; vfs_path_t *fname_vpath;
@ -141,18 +145,16 @@ do_view_cmd (WPanel * panel, gboolean plain_view)
_("&Yes"), _("&No")) != 0) _("&Yes"), _("&No")) != 0)
return; return;
fname_vpath = vfs_path_from_str (selection (panel)->fname->str); fname_vpath = vfs_path_from_str (fe->fname->str);
if (!panel_cd (panel, fname_vpath, cd_exact)) if (!panel_cd (panel, fname_vpath, cd_exact))
message (D_ERROR, MSG_ERROR, _("Cannot change directory")); message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
vfs_path_free (fname_vpath, TRUE); vfs_path_free (fname_vpath, TRUE);
} }
else else
{ {
int file_idx;
vfs_path_t *filename_vpath; vfs_path_t *filename_vpath;
file_idx = panel->selected; filename_vpath = vfs_path_from_str (fe->fname->str);
filename_vpath = vfs_path_from_str (panel->dir.list[file_idx].fname->str);
view_file (filename_vpath, plain_view, use_internal_view); view_file (filename_vpath, plain_view, use_internal_view);
vfs_path_free (filename_vpath, TRUE); vfs_path_free (filename_vpath, TRUE);
} }
@ -589,7 +591,7 @@ view_file (const vfs_path_t * filename_vpath, gboolean plain_view, gboolean inte
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Run user's preferred viewer on the currently selected file */ /** Run user's preferred viewer on the current file */
void void
view_cmd (WPanel * panel) view_cmd (WPanel * panel)
@ -608,7 +610,7 @@ view_file_cmd (const WPanel * panel)
filename = filename =
input_expand_dialog (_("View file"), _("Filename:"), input_expand_dialog (_("View file"), _("Filename:"),
MC_HISTORY_FM_VIEW_FILE, selection (panel)->fname->str, MC_HISTORY_FM_VIEW_FILE, panel_current_entry (panel)->fname->str,
INPUT_COMPLETE_FILENAMES); INPUT_COMPLETE_FILENAMES);
if (filename == NULL) if (filename == NULL)
return; return;
@ -620,7 +622,7 @@ view_file_cmd (const WPanel * panel)
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Run plain internal viewer on the currently selected file */ /** Run plain internal viewer on the current file */
void void
view_raw_cmd (WPanel * panel) view_raw_cmd (WPanel * panel)
{ {
@ -636,7 +638,7 @@ view_filtered_cmd (const WPanel * panel)
const char *initial_command; const char *initial_command;
if (input_is_empty (cmdline)) if (input_is_empty (cmdline))
initial_command = selection (panel)->fname->str; initial_command = panel_current_entry (panel)->fname->str;
else else
initial_command = input_get_ctext (cmdline); initial_command = input_get_ctext (cmdline);
@ -698,7 +700,7 @@ edit_cmd (const WPanel * panel)
{ {
vfs_path_t *fname; vfs_path_t *fname;
fname = vfs_path_from_str (selection (panel)->fname->str); fname = vfs_path_from_str (panel_current_entry (panel)->fname->str);
if (regex_command (fname, "Edit") == 0) if (regex_command (fname, "Edit") == 0)
do_edit (fname); do_edit (fname);
vfs_path_free (fname, TRUE); vfs_path_free (fname, TRUE);
@ -712,7 +714,7 @@ edit_cmd_force_internal (const WPanel * panel)
{ {
vfs_path_t *fname; vfs_path_t *fname;
fname = vfs_path_from_str (selection (panel)->fname->str); fname = vfs_path_from_str (panel_current_entry (panel)->fname->str);
if (regex_command (fname, "Edit") == 0) if (regex_command (fname, "Edit") == 0)
edit_file_at_line (fname, TRUE, 1); edit_file_at_line (fname, TRUE, 1);
vfs_path_free (fname, TRUE); vfs_path_free (fname, TRUE);
@ -754,12 +756,15 @@ edit_cmd_new (void)
void void
mkdir_cmd (WPanel * panel) mkdir_cmd (WPanel * panel)
{ {
const file_entry_t *fe;
char *dir; char *dir;
const char *name = ""; const char *name = "";
/* If 'on' then automatically fills name with current selected item name */ fe = panel_current_entry (panel);
if (auto_fill_mkdir_name && !DIR_IS_DOTDOT (selection (panel)->fname->str))
name = selection (panel)->fname->str; /* If 'on' then automatically fills name with current item name */
if (auto_fill_mkdir_name && !DIR_IS_DOTDOT (fe->fname->str))
name = fe->fname->str;
dir = dir =
input_expand_dialog (_("Create a new Directory"), input_expand_dialog (_("Create a new Directory"),
@ -1075,8 +1080,9 @@ swap_cmd (void)
void void
link_cmd (link_type_t link_type) link_cmd (link_type_t link_type)
{ {
const char *filename = selection (current_panel)->fname->str; const char *filename;
filename = panel_current_entry (current_panel)->fname->str;
if (filename != NULL) if (filename != NULL)
do_link (link_type, filename); do_link (link_type, filename);
} }
@ -1089,7 +1095,7 @@ edit_symlink_cmd (void)
const file_entry_t *fe; const file_entry_t *fe;
const char *p; const char *p;
fe = selection (current_panel); fe = panel_current_entry (current_panel);
p = fe->fname->str; p = fe->fname->str;
if (!S_ISLNK (fe->st.st_mode)) if (!S_ISLNK (fe->st.st_mode))
@ -1242,8 +1248,9 @@ quick_cd_cmd (WPanel * panel)
void void
smart_dirsize_cmd (WPanel * panel) smart_dirsize_cmd (WPanel * panel)
{ {
const file_entry_t *entry = &panel->dir.list[panel->selected]; const file_entry_t *entry;
entry = panel_current_entry (panel);
if ((S_ISDIR (entry->st.st_mode) && DIR_IS_DOTDOT (entry->fname->str)) || panel->dirs_marked) if ((S_ISDIR (entry->st.st_mode) && DIR_IS_DOTDOT (entry->fname->str)) || panel->dirs_marked)
dirsizes_cmd (panel); dirsizes_cmd (panel);
else else
@ -1255,7 +1262,9 @@ smart_dirsize_cmd (WPanel * panel)
void void
single_dirsize_cmd (WPanel * panel) single_dirsize_cmd (WPanel * panel)
{ {
file_entry_t *entry = &panel->dir.list[panel->selected]; file_entry_t *entry;
entry = panel_current_entry (panel);
if (S_ISDIR (entry->st.st_mode) && !DIR_IS_DOTDOT (entry->fname->str)) if (S_ISDIR (entry->st.st_mode) && !DIR_IS_DOTDOT (entry->fname->str))
{ {

View File

@ -1797,7 +1797,7 @@ panel_get_file (const WPanel * panel)
return panel->dir.list[i].fname->str; return panel->dir.list[i].fname->str;
} }
return panel->dir.list[panel->selected].fname->str; return panel_current_entry (panel)->fname->str;
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -1809,7 +1809,7 @@ check_single_entry (const WPanel * panel, gboolean force_single, struct stat *sr
gboolean ok; gboolean ok;
if (force_single) if (force_single)
source = selection (panel)->fname->str; source = panel_current_entry (panel)->fname->str;
else else
source = panel_get_file (panel); source = panel_get_file (panel);
@ -3277,7 +3277,7 @@ compute_dir_size (const vfs_path_t * dirname_vpath, dirsize_status_msg_t * sm,
/** /**
* panel_operate: * panel_operate:
* *
* Performs one of the operations on the selection on the source_panel * Performs one of the operations on the current on the source_panel
* (copy, delete, move). * (copy, delete, move).
* *
* Returns TRUE if did change the directory * Returns TRUE if did change the directory
@ -3381,7 +3381,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
{ {
if (operation == OP_DELETE) if (operation == OP_DELETE)
dialog_type = FILEGUI_DIALOG_DELETE_ITEM; dialog_type = FILEGUI_DIALOG_DELETE_ITEM;
else if (single_entry && S_ISDIR (selection (panel)->st.st_mode)) else if (single_entry && S_ISDIR (panel_current_entry (panel)->st.st_mode))
dialog_type = FILEGUI_DIALOG_MULTI_ITEM; dialog_type = FILEGUI_DIALOG_MULTI_ITEM;
else if (single_entry || force_single) else if (single_entry || force_single)
dialog_type = FILEGUI_DIALOG_ONE_ITEM; dialog_type = FILEGUI_DIALOG_ONE_ITEM;

View File

@ -152,7 +152,7 @@ treebox_cmd (void)
{ {
char *sel_dir; char *sel_dir;
sel_dir = tree_box (selection (current_panel)->fname->str); sel_dir = tree_box (panel_current_entry (current_panel)->fname->str);
if (sel_dir != NULL) if (sel_dir != NULL)
{ {
vfs_path_t *sel_vdir; vfs_path_t *sel_vdir;
@ -724,16 +724,20 @@ midnight_put_panel_path (WPanel * panel)
static void static void
put_link (WPanel * panel) put_link (WPanel * panel)
{ {
const file_entry_t *fe;
if (!command_prompt) if (!command_prompt)
return; return;
if (S_ISLNK (selection (panel)->st.st_mode))
fe = panel_current_entry (panel);
if (S_ISLNK (fe->st.st_mode))
{ {
char buffer[MC_MAXPATHLEN]; char buffer[MC_MAXPATHLEN];
vfs_path_t *vpath; vfs_path_t *vpath;
int i; int i;
vpath = vpath = vfs_path_append_new (panel->cwd_vpath, fe->fname->str, (char *) NULL);
vfs_path_append_new (panel->cwd_vpath, selection (panel)->fname->str, (char *) NULL);
i = mc_readlink (vpath, buffer, sizeof (buffer) - 1); i = mc_readlink (vpath, buffer, sizeof (buffer) - 1);
vfs_path_free (vpath, TRUE); vfs_path_free (vpath, TRUE);
@ -783,7 +787,7 @@ put_current_selected (void)
tmp = vfs_path_as_str (selected_name); tmp = vfs_path_as_str (selected_name);
} }
else else
tmp = selection (current_panel)->fname->str; tmp = panel_current_entry (current_panel)->fname->str;
command_insert (cmdline, tmp, TRUE); command_insert (cmdline, tmp, TRUE);
} }
@ -807,9 +811,8 @@ put_tagged (WPanel * panel)
} }
} }
else else
{ command_insert (cmdline, panel_current_entry (panel)->fname->str, TRUE);
command_insert (cmdline, panel->dir.list[panel->selected].fname->str, TRUE);
}
input_enable_update (cmdline); input_enable_update (cmdline);
} }
@ -1027,7 +1030,7 @@ show_editor_viewer_history (void)
d = g_path_get_dirname (s); d = g_path_get_dirname (s);
s_vpath = vfs_path_from_str (d); s_vpath = vfs_path_from_str (d);
panel_cd (current_panel, s_vpath, cd_exact); panel_cd (current_panel, s_vpath, cd_exact);
try_to_select (current_panel, s); panel_set_current_by_name (current_panel, s);
g_free (d); g_free (d);
} }
} }

View File

@ -1932,8 +1932,7 @@ find_cmd (WPanel * panel)
panel_cd (panel, dirname_vpath, cd_exact); panel_cd (panel, dirname_vpath, cd_exact);
vfs_path_free (dirname_vpath, TRUE); vfs_path_free (dirname_vpath, TRUE);
if (filename != NULL) if (filename != NULL)
try_to_select (panel, panel_set_current_by_name (panel, filename + (content_pattern != NULL
filename + (content_pattern != NULL
? strchr (filename + 4, ':') - filename + 1 : 4)); ? strchr (filename + 4, ':') - filename + 1 : 4));
} }
else if (filename != NULL) else if (filename != NULL)
@ -1956,7 +1955,7 @@ find_cmd (WPanel * panel)
if (v == B_PANELIZE) if (v == B_PANELIZE)
{ {
panel_re_sort (panel); panel_re_sort (panel);
try_to_select (panel, NULL); panel_set_current_by_name (panel, NULL);
break; break;
} }
} }

View File

@ -107,6 +107,7 @@ static void
info_show_info (WInfo * info) info_show_info (WInfo * info)
{ {
const WRect *w = &CONST_WIDGET (info)->rect; const WRect *w = &CONST_WIDGET (info)->rect;
const file_entry_t *fe;
static int i18n_adjust = 0; static int i18n_adjust = 0;
static const char *file_label; static const char *file_label;
GString *buff; GString *buff;
@ -136,7 +137,9 @@ info_show_info (WInfo * info)
my_statfs (&myfs_stats, p_rp_cwd); my_statfs (&myfs_stats, p_rp_cwd);
st = current_panel->dir.list[current_panel->selected].st; fe = panel_current_entry (current_panel);
st = fe->st;
/* Print only lines which fit */ /* Print only lines which fit */
@ -263,7 +266,7 @@ info_show_info (WInfo * info)
vfs_path_t *vpath; vfs_path_t *vpath;
unsigned long attr; unsigned long attr;
vpath = vfs_path_from_str (current_panel->dir.list[current_panel->selected].fname->str); vpath = vfs_path_from_str (fe->fname->str);
#ifdef ENABLE_EXT2FS_ATTR #ifdef ENABLE_EXT2FS_ATTR
if (mc_fgetflags (vpath, &attr) == 0) if (mc_fgetflags (vpath, &attr) == 0)
@ -289,7 +292,7 @@ info_show_info (WInfo * info)
const char *fname; const char *fname;
widget_gotoyx (w, 3, 2); widget_gotoyx (w, 3, 2);
fname = current_panel->dir.list[current_panel->selected].fname->str; fname = fe->fname->str;
str_printf (buff, file_label, str_trunc (fname, w->cols - i18n_adjust)); str_printf (buff, file_label, str_trunc (fname, w->cols - i18n_adjust));
tty_print_string (buff->str); tty_print_string (buff->str);
} }

View File

@ -1200,7 +1200,7 @@ create_panel (int num, panel_view_mode_t type)
new_widget = WIDGET (mcview_new (r.y, r.x, r.lines, r.cols, TRUE)); new_widget = WIDGET (mcview_new (r.y, r.x, r.lines, r.cols, TRUE));
the_other_panel = PANEL (panels[the_other].widget); the_other_panel = PANEL (panels[the_other].widget);
if (the_other_panel != NULL) if (the_other_panel != NULL)
file_name = the_other_panel->dir.list[the_other_panel->selected].fname->str; file_name = panel_current_entry (the_other_panel)->fname->str;
else else
file_name = ""; file_name = "";
@ -1300,7 +1300,7 @@ swap_panels (void)
panelswap (dirs_marked); panelswap (dirs_marked);
panelswap (total); panelswap (total);
panelswap (top_file); panelswap (top_file);
panelswap (selected); panelswap (current);
panelswap (is_panelized); panelswap (is_panelized);
panelswap (panelized_descr); panelswap (panelized_descr);
panelswap (dir_stat); panelswap (dir_stat);

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/
#define PANEL(x) ((WPanel *)(x)) #define PANEL(x) ((WPanel *)(x))
#define selection(p) (&(p->dir.list[p->selected]))
#define DEFAULT_USER_FORMAT "half type name | size | perm" #define DEFAULT_USER_FORMAT "half type name | size | perm"
#define LIST_FORMATS 4 #define LIST_FORMATS 4
@ -117,7 +116,7 @@ typedef struct
uintmax_t total; /* Bytes in marked files */ uintmax_t total; /* Bytes in marked files */
int top_file; /* The file showed on the top of the panel */ int top_file; /* The file showed on the top of the panel */
int selected; /* Index to the selected file */ int current; /* Index to the currently selected file */
GSList *status_format; /* Mini status format */ GSList *status_format; /* Mini status format */
gboolean user_mini_status; /* Is user_status_format used */ gboolean user_mini_status; /* Is user_status_format used */
@ -173,7 +172,7 @@ int set_panel_formats (WPanel * p);
void panel_set_filter (WPanel * panel, const file_filter_t * filter); void panel_set_filter (WPanel * panel, const file_filter_t * filter);
void try_to_select (WPanel * panel, const char *name); void panel_set_current_by_name (WPanel * panel, const char *name);
void unmark_files (WPanel * panel); void unmark_files (WPanel * panel);
void select_item (WPanel * panel); void select_item (WPanel * panel);
@ -275,4 +274,12 @@ panel_sized_new (const char *panel_name, int y, int x, int lines, int cols)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static inline file_entry_t *
panel_current_entry (const WPanel * panel)
{
return &(panel->dir.list[panel->current]);
}
/* --------------------------------------------------------------------------------------------- */
#endif /* MC__PANEL_H */ #endif /* MC__PANEL_H */

View File

@ -427,7 +427,7 @@ do_external_panelize (const char *command)
current_panel->is_panelized = TRUE; current_panel->is_panelized = TRUE;
panel_panelize_absolutize_if_needed (current_panel); panel_panelize_absolutize_if_needed (current_panel);
try_to_select (current_panel, NULL); panel_set_current_by_name (current_panel, NULL);
panel_re_sort (current_panel); panel_re_sort (current_panel);
rotate_dash (FALSE); rotate_dash (FALSE);
} }

View File

@ -170,7 +170,9 @@ static gboolean
test_type (WPanel * panel, char *arg) test_type (WPanel * panel, char *arg)
{ {
int result = 0; /* False by default */ int result = 0; /* False by default */
mode_t st_mode = panel->dir.list[panel->selected].st.st_mode; mode_t st_mode;
st_mode = panel_current_entry (panel)->st.st_mode;
for (; *arg != '\0'; arg++) for (; *arg != '\0'; arg++)
{ {
@ -263,7 +265,7 @@ test_condition (const Widget * edit_widget, char *p, gboolean * condition)
else else
#endif #endif
*condition = panel != NULL && *condition = panel != NULL &&
mc_search (arg, DEFAULT_CHARSET, panel->dir.list[panel->selected].fname->str, mc_search (arg, DEFAULT_CHARSET, panel_current_entry (panel)->fname->str,
search_type); search_type);
break; break;
case 'y': /* syntax pattern */ case 'y': /* syntax pattern */
@ -781,7 +783,7 @@ expand_format (const Widget * edit_widget, char c, gboolean do_quote)
panel = other_panel; panel = other_panel;
} }
fname = panel->dir.list[panel->selected].fname->str; fname = panel_current_entry (panel)->fname->str;
} }
break; break;

View File

@ -194,7 +194,7 @@ mcview_hook (void *v)
mcview_done (view); mcview_done (view);
mcview_init (view); mcview_init (view);
mcview_load (view, 0, panel->dir.list[panel->selected].fname->str, 0, 0, 0); mcview_load (view, 0, panel_current_entry (panel)->fname->str, 0, 0, 0);
mcview_display (view); mcview_display (view);
} }
@ -274,7 +274,7 @@ mcview_load_next_prev_init (WView * view)
{ {
/* get file list from current panel. Update it each time */ /* get file list from current panel. Update it each time */
view->dir = &current_panel->dir; view->dir = &current_panel->dir;
view->dir_idx = &current_panel->selected; view->dir_idx = &current_panel->current;
} }
else if (view->dir == NULL) else if (view->dir == NULL)
{ {

View File

@ -76,7 +76,7 @@ START_TEST (sanitize_variables)
GString *actual_string; GString *actual_string;
const char *expected_string; const char *expected_string;
current_panel->selected = 0; current_panel->current = 0;
current_panel->dir.len = 3; current_panel->dir.len = 3;
current_panel->dir.list[0].fname = g_string_new ("selected file.txt"); current_panel->dir.list[0].fname = g_string_new ("selected file.txt");
current_panel->dir.list[1].fname = g_string_new ("tagged file1.txt"); current_panel->dir.list[1].fname = g_string_new ("tagged file1.txt");