From 548e5115bb86dc858243114654afd3584f35c240 Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Sat, 17 May 2008 13:12:21 +0000 Subject: Add 'word_completion_backward' command to scroll backwards in the completion list, bug #313. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4830 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/completion.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/fe-common/core/completion.c') diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c index f0df4123..a5bf609b 100644 --- a/src/fe-common/core/completion.c +++ b/src/fe-common/core/completion.c @@ -128,7 +128,7 @@ static void free_completions(void) } /* manual word completion - called when TAB is pressed */ -char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase) +char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, int backward) { static int startpos = 0, wordlen = 0; int old_startpos, old_wordlen; @@ -205,8 +205,12 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase) if (continue_complete) { /* complete from old list */ - complist = complist->next != NULL ? complist->next : - g_list_first(complist); + if (backward) + complist = complist->prev != NULL ? complist->prev : + g_list_last(complist); + else + complist = complist->next != NULL ? complist->next : + g_list_first(complist); want_space = last_want_space; } else { /* get new completion list */ -- cgit v1.2.3