From f95d2762503004170fd26be24f92e517acf95855 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 18 Feb 2003 06:19:11 +0000 Subject: [PATCH] * main.c (directory_history_list): Allow history command even with just one entry - it's more intuitive. --- src/ChangeLog | 3 +++ src/main.c | 31 ++++++++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b95f7764f..f2f25639c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2003-02-18 Pavel Roskin + * 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 and remove duplicates. * main.c (directory_history_add): Use list_append_unique(). diff --git a/src/main.c b/src/main.c index ad68ba628..acf0f5499 100644 --- a/src/main.c +++ b/src/main.c @@ -833,23 +833,20 @@ void directory_history_list (WPanel *panel) { char *s; -/* must be at least two to show a history */ - if (panel->dir_history) { - if (panel->dir_history->prev || panel->dir_history->next) { - s = show_hist (panel->dir_history, panel->widget.x, - panel->widget.y); - if (s) { - int r; - r = _do_panel_cd (panel, s, cd_exact); - if (r) - directory_history_add (panel, panel->cwd); - else - message (1, MSG_ERROR, - _("Cannot change directory")); - g_free (s); - } - } - } + + if (!panel->dir_history) + return; + + s = show_hist (panel->dir_history, panel->widget.x, panel->widget.y); + + if (!s) + return; + + if (_do_panel_cd (panel, s, cd_exact)) + directory_history_add (panel, panel->cwd); + else + message (1, MSG_ERROR, _("Cannot change directory")); + g_free (s); } #ifdef HAVE_SUBSHELL_SUPPORT