From 87e9bbd830f6bab5d344852d45e46ae71f5bc113 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 28 May 2003 23:02:53 +0000 Subject: * src/completions.c (completions_complete): if direction is COMPLETION_PREVIOUS, then set last_match to it's previous entry. --- src/completions.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/completions.c b/src/completions.c index 314bd23..1347e7c 100644 --- a/src/completions.c +++ b/src/completions.c @@ -136,6 +136,13 @@ completions_complete (rp_completions *c, char *partial, int direction) if (c->last_match == NULL) return NULL; + /* c->last_match contains the first match in the forward + direction. So if we're looking for the previous match, then + check the previous element from last_match. */ + if (direction == COMPLETION_PREVIOUS) + c->last_match = list_prev_entry (c->last_match, &c->completion_list, node); + + /* Now check if last_match is a match for partial. */ if (str_comp (sbuf_get (c->last_match), c->partial, strlen (c->partial))) return sbuf_get (c->last_match); } -- cgit v1.2.3