hirc

IRC client
Log | Files | Refs

commit d7e3806a841bf9428fe325937f97a4e7d54388a2
parent 87208e867027121e46027530844d8323172751ed
Author: hhvn <dev@hhvn.uk>
Date:   Mon, 23 May 2022 20:37:29 +0100

Complete aliases

Diffstat:
Msrc/complete.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/complete.c b/src/complete.c @@ -72,10 +72,18 @@ complete_add(char **ret, char *str, int *fullcomplete) { void complete_cmds(char *str, size_t len, char **ret, int *fullcomplete) { + struct Alias *p; + char *tmp; int i; for (i = 0; commands[i].name; i++) if (strncmp(commands[i].name, str, len) == 0) complete_add(ret, commands[i].name, fullcomplete); + tmp = emalloc(len + 2); + snprintf(tmp, len + 2, "/%s", str); + for (p = aliases; p; p = p->next) + if (strncmp(p->alias, tmp, len + 1) == 0) + complete_add(ret, p->alias + 1, fullcomplete); + pfree(&tmp); } void