~sircmpwn/imrsh

b97ad8e5b58061920f48d32f0343f66d5896a934 — Karl Rieländer 2 years ago fd5f250 master
Fix history cycling

Previously, the displayed command didn't change when switching cycling
direction. This resolves the issue.
1 files changed, 3 insertions(+), 2 deletions(-)

M src/history.c
M src/history.c => src/history.c +3 -2
@@ 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;
}