# HG changeset patch # User Matti Hamalainen # Date 1337853931 -10800 # Node ID 2ac24f1e241bb95e96244e6aeb0f0547cf175169 # Parent 162011bbec48077f63cb224d4a5e78f943b01f16 Start working on command completion. diff -r 162011bbec48 -r 2ac24f1e241b main.c --- a/main.c Thu May 24 12:30:39 2012 +0300 +++ b/main.c Thu May 24 13:05:31 2012 +0300 @@ -1336,7 +1336,8 @@ BOOL performTabCompletion(nn_editbuf_t *buf) { static char *previous = NULL, *pattern = NULL; - BOOL again = FALSE, hasSeparator = FALSE, newPattern = FALSE, hasSpace = FALSE; + BOOL again = FALSE, hasSeparator = FALSE, + newPattern = FALSE, hasSpace = FALSE, isCommand; char *str = buf->data; int mode = 0; ssize_t endPos, startPos = buf->pos; @@ -1376,7 +1377,10 @@ return FALSE; } - if (str[endPos] == optNickSep) + // Check if this is a command completion + isCommand = (str[0] == '/' && startPos == 0); + + if (!isCommand && str[endPos] == optNickSep) { endPos--; if (startPos > 0) @@ -1420,7 +1424,20 @@ newPattern ? "yes" : "no", mode); } - if (pattern) + if (!pattern) + return FALSE; + + if (isCommand) + { +/* + int i; + for (i = 0; i < nuserCmds; i++) + { + if (nncmd_match(pattern, + } +*/ + } + else { nn_user_t *user = nn_user_match(nnUsers, pattern, previous, again);