diff options
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/completion.c | 10 | ||||
-rw-r--r-- | src/fe-common/core/completion.h | 2 |
2 files changed, 8 insertions, 4 deletions
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 */ diff --git a/src/fe-common/core/completion.h b/src/fe-common/core/completion.h index 9a8b32cb..5c1e6958 100644 --- a/src/fe-common/core/completion.h +++ b/src/fe-common/core/completion.h @@ -8,7 +8,7 @@ char *auto_word_complete(const char *line, int *pos); /* manual word completion - called when TAB is pressed. if erase is TRUE, the word is removed from completion list entirely (if possible) and next completion is used */ -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); GList *filename_complete(const char *path, const char *default_path); |