From cf0a062b862d790d7e14347c1b78dbf9e464cbcb Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Sat, 20 Oct 2007 16:47:10 +0000 Subject: [PATCH] Made history cycle behave more like console git-svn-id: http://sanoi.webfactional.com/trunk@114 79def182-f41f-0410-b320-e94a04284523 --- src/ui-history.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/ui-history.c b/src/ui-history.c index 81b5f0f..326be4d 100644 --- a/src/ui-history.c +++ b/src/ui-history.c @@ -260,18 +260,20 @@ gboolean famahistory_command_loadpre() { HIST_ENTRY *he; - gint offset, totalcnt; + gint offset, totalcnt; totalcnt = famahistory_number(); offset = famahis.currentpos;// where_history(); offset--; - if (offset == history_base - 1) - offset = totalcnt + history_base; + he = famahistory_get(offset); - if (he) + if (he) { commandline_set_cmd(he->line); - else + famahis.currentpos = offset; + } + else { commandline_set_cmd(NULL); - famahis.currentpos = offset; + famahis.currentpos = history_base - 1; + } return TRUE; } @@ -279,18 +281,20 @@ gboolean famahistory_command_loadnext() { HIST_ENTRY *he; - gint offset, totalcnt; + gint offset, totalcnt; totalcnt = famahistory_number(); offset = famahis.currentpos;// where_history(); offset++; - if (offset == history_base + totalcnt + 1) - offset = history_base; + he = famahistory_get(offset); - if (he) + if (he) { commandline_set_cmd(he->line); - else + famahis.currentpos = offset; + } + else { commandline_set_cmd(NULL); - famahis.currentpos = offset; + famahis.currentpos = totalcnt; + } return TRUE; }