~emersion/mrsh-dev

imrsh: Fix history cycling v1 PROPOSED

Karl Rieländer: 1
 Fix history cycling

 1 files changed, 3 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/mrsh-dev/patches/21313/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH imrsh] Fix history cycling Export this patch

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