From 41bbb304b1e6898afc96a36bf4216aaea13be4f3 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 1 Apr 2018 16:10:10 +0200 Subject: [PATCH] Export internal el_next_hist() and el_prev_hist() Signed-off-by: Joachim Nilsson --- include/editline.h | 3 +++ src/editline.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/editline.h b/include/editline.h index 597e6df..ee5749f 100644 --- a/include/editline.h +++ b/include/editline.h @@ -65,6 +65,9 @@ extern el_status_t el_del_char(void); extern el_status_t el_bind_key(int key, el_keymap_func_t function); extern el_status_t el_bind_key_in_metamap(int key, el_keymap_func_t function); +extern const char *el_next_hist(void); +extern const char *el_prev_hist(void); + extern char *rl_complete(char *token, int *match); extern int rl_list_possib(char *token, char ***av); diff --git a/src/editline.c b/src/editline.c index 6d82b84..5b4872d 100644 --- a/src/editline.c +++ b/src/editline.c @@ -551,12 +551,12 @@ static el_status_t toggle_meta_mode(void) } -static const char *next_hist(void) +const char *el_next_hist(void) { return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos]; } -static const char *prev_hist(void) +const char *el_prev_hist(void) { return H.Pos == 0 ? NULL : H.Lines[--H.Pos]; } @@ -593,7 +593,7 @@ static el_status_t h_next(void) if (el_no_hist) return CSstay; - return do_hist(next_hist); + return do_hist(el_next_hist); } static el_status_t h_prev(void) @@ -601,7 +601,7 @@ static el_status_t h_prev(void) if (el_no_hist) return CSstay; - return do_hist(prev_hist); + return do_hist(el_prev_hist); } static el_status_t h_first(void) @@ -701,7 +701,7 @@ static el_status_t h_search(void) rl_prompt = "Search: "; tty_puts(rl_prompt); - search_move = Repeat == NO_ARG ? prev_hist : next_hist; + search_move = Repeat == NO_ARG ? el_prev_hist : el_next_hist; if (line_handler) { editinput(0); return CSstay;