src/filemanager/panel.c: (cd_up_dir): new function.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-01-01 18:31:30 +03:00
parent 8299455519
commit 762c8ed2d1
1 changed files with 15 additions and 17 deletions

View File

@ -1971,6 +1971,18 @@ mini_status_format (WPanel * panel)
/* Panel operation commands */ /* Panel operation commands */
/* */ /* */
/* --------------------------------------------------------------------------------------------- */
static void
cd_up_dir (void)
{
vfs_path_t *up_dir;
up_dir = vfs_path_from_str ("..");
do_cd (up_dir, cd_exact);
vfs_path_free (up_dir);
}
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** Used to emulate Lynx's entering leaving a directory with the arrow keys */ /** Used to emulate Lynx's entering leaving a directory with the arrow keys */
@ -1981,11 +1993,7 @@ maybe_cd (gboolean move_up_dir)
{ {
if (move_up_dir) if (move_up_dir)
{ {
vfs_path_t *up_dir; cd_up_dir ();
up_dir = vfs_path_from_str ("..");
do_cd (up_dir, cd_exact);
vfs_path_free (up_dir);
return MSG_HANDLED; return MSG_HANDLED;
} }
@ -2012,11 +2020,7 @@ force_maybe_cd (void)
{ {
if (input_is_empty (cmdline)) if (input_is_empty (cmdline))
{ {
vfs_path_t *up_dir; cd_up_dir ();
up_dir = vfs_path_from_str ("..");
do_cd (up_dir, cd_exact);
vfs_path_free (up_dir);
return MSG_HANDLED; return MSG_HANDLED;
} }
@ -2255,13 +2259,7 @@ static void
goto_parent_dir (WPanel * panel) goto_parent_dir (WPanel * panel)
{ {
if (!panel->is_panelized) if (!panel->is_panelized)
{ cd_up_dir ();
vfs_path_t *up_dir;
up_dir = vfs_path_from_str ("..");
do_cd (up_dir, cd_exact);
vfs_path_free (up_dir);
}
else else
{ {
char *fname = panel->dir.list[panel->selected].fname; char *fname = panel->dir.list[panel->selected].fname;