summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-05-28 23:02:53 +0000
committersabetts <sabetts>2003-05-28 23:02:53 +0000
commit87e9bbd830f6bab5d344852d45e46ae71f5bc113 (patch)
tree2fe337bd0851f9481c66ba1ec52a190c1f400aaa /src
parent99d6bf980b231670ef58d12e082cfd52e0513707 (diff)
downloadratpoison-87e9bbd830f6bab5d344852d45e46ae71f5bc113.zip
* src/completions.c (completions_complete): if direction is
COMPLETION_PREVIOUS, then set last_match to it's previous entry.
Diffstat (limited to 'src')
-rw-r--r--src/completions.c7
1 files changed, 7 insertions, 0 deletions
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);
}