Previously, the displayed command didn't change when switching cycling
direction. This resolves the issue.
---
src/history.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/history.c b/src/history.c
index cf7f966..16c024e 100644
--- a/src/history.c
+++ b/src/history.c
@@ -151,6 +151,7 @@ const char *imrsh_history_prev(const struct imrsh_history *history,
{
if (cursor->prev == NULL) {
cursor->prev = history->tail;
+ return cursor->prev->cmd;
}
if (cursor->prev == history->entries) {
return cursor->prev->cmd;
@@ -158,7 +159,7 @@ const char *imrsh_history_prev(const struct imrsh_history *history,
struct imrsh_history_entry *prev = cursor->prev;
cursor->next = prev;
cursor->prev = prev->prev;
- return prev->cmd;
+ return cursor->prev->cmd;
}
const char *imrsh_history_next(const struct imrsh_history *history,
@@ -171,5 +172,5 @@ const char *imrsh_history_next(const struct imrsh_history *history,
struct imrsh_history_entry *next = cursor->next;
cursor->prev = next;
cursor->next = next->next;
- return next->cmd;
+ return cursor->prev->cmd;
}
--
2.30.1
Thanks!
To git@git.sr.ht:~sircmpwn/imrsh
b97ad8e.. master -> master