summaryrefslogtreecommitdiff
path: root/src/completions.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-05-27 18:46:33 +0000
committersabetts <sabetts>2003-05-27 18:46:33 +0000
commitc590e039dac7c9edd4074d8e52f7928e789b5078 (patch)
tree3cf0673d90d641f5d386ea647c1b8078813a9214 /src/completions.c
parent416fd6f8a57877da6700bbb95008dacb84caf4e8 (diff)
downloadratpoison-c590e039dac7c9edd4074d8e52f7928e789b5078.zip
* src/completions.c (completions_next_completion): check
c->last_match as a match to partial on a virgin completion. * src/group.c (free_groups): new function * src/group.h (free_groups): new prototype * src/main.c (clean_up): call free_groups * src/actions.c (cmd_fdump): free the string returned by frame_dump. * src/completions.c (completions_update): free new_list.
Diffstat (limited to 'src/completions.c')
-rw-r--r--src/completions.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/completions.c b/src/completions.c
index 970897d..6f2ed12 100644
--- a/src/completions.c
+++ b/src/completions.c
@@ -71,6 +71,9 @@ completions_update (rp_completions *c, char *partial)
c->partial = xstrdup (partial);
completions_assign (c, new_list);
+
+ /* Free the head structure for our list. */
+ free (new_list);
}
/* Return a completed string that starts with partial. */
@@ -80,11 +83,24 @@ completions_next_completion (rp_completions *c, char *partial)
struct sbuf *cur;
if (c->virgin)
- completions_update (c, partial);
+ {
+ completions_update (c, partial);
+
+ /* Since it's never been completed on and c->last_match points
+ to the first element of the list which may be a match. So
+ check it. FIXME: This is a bit of a hack. */
+ if (c->last_match == NULL)
+ return NULL;
+
+ if (str_comp (sbuf_get (c->last_match), c->partial, strlen (c->partial)))
+ return sbuf_get (c->last_match);
+ }
if (c->last_match == NULL)
return NULL;
+ /* */
+
/* search forward from our last match through the list looking for
another match. */
for (cur = list_next_entry (c->last_match, &c->completion_list, node);