* main.c (directory_history_list): Allow history command even

with just one entry - it's more intuitive.
This commit is contained in:
Pavel Roskin 2003-02-18 06:19:11 +00:00
parent 738e33006b
commit f95d276250
2 changed files with 17 additions and 17 deletions

View File

@ -1,5 +1,8 @@
2003-02-18 Pavel Roskin <proski@gnu.org> 2003-02-18 Pavel Roskin <proski@gnu.org>
* main.c (directory_history_list): Allow history command even
with just one entry - it's more intuitive.
* util.c (list_append_unique): New function - add text to GList * util.c (list_append_unique): New function - add text to GList
and remove duplicates. and remove duplicates.
* main.c (directory_history_add): Use list_append_unique(). * main.c (directory_history_add): Use list_append_unique().

View File

@ -833,23 +833,20 @@ void
directory_history_list (WPanel *panel) directory_history_list (WPanel *panel)
{ {
char *s; char *s;
/* must be at least two to show a history */
if (panel->dir_history) { if (!panel->dir_history)
if (panel->dir_history->prev || panel->dir_history->next) { return;
s = show_hist (panel->dir_history, panel->widget.x,
panel->widget.y); s = show_hist (panel->dir_history, panel->widget.x, panel->widget.y);
if (s) {
int r; if (!s)
r = _do_panel_cd (panel, s, cd_exact); return;
if (r)
directory_history_add (panel, panel->cwd); if (_do_panel_cd (panel, s, cd_exact))
else directory_history_add (panel, panel->cwd);
message (1, MSG_ERROR, else
_("Cannot change directory")); message (1, MSG_ERROR, _("Cannot change directory"));
g_free (s); g_free (s);
}
}
}
} }
#ifdef HAVE_SUBSHELL_SUPPORT #ifdef HAVE_SUBSHELL_SUPPORT