Mercurial > hg > nnchat
diff main.c @ 429:2ac24f1e241b
Start working on command completion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 May 2012 13:05:31 +0300 |
parents | 341ac6f99439 |
children | aaadf6cea6be |
line wrap: on
line diff
--- 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);