From f6107d6826294d7a49d6fea176b37e3cc8c930e0 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Fri, 19 May 2006 19:35:16 +0000 Subject: Fix tab completion when you just do a plain tab without entering anything, and also fix show application tab completion. (issue #7089 reported by blitzrage) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@28792 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- cli.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cli.c') diff --git a/cli.c b/cli.c index 0c5e84088..491472231 100644 --- a/cli.c +++ b/cli.c @@ -1313,7 +1313,7 @@ static char *__ast_cli_generator(const char *text, const char *word, int state, int matchnum=0; char *ret = NULL; char matchstr[80] = ""; - int tws; + int tws = 0; char *dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws); if (!dup) /* error */ @@ -1321,9 +1321,12 @@ static char *__ast_cli_generator(const char *text, const char *word, int state, argindex = (!ast_strlen_zero(word) && x>0) ? x-1 : x; /* rebuild the command, ignore tws */ ast_join(matchstr, sizeof(matchstr)-1, argv); - if (tws) - strcat(matchstr, " "); /* XXX */ matchlen = strlen(matchstr); + if (tws) { + strcat(matchstr, " "); /* XXX */ + if (matchlen) + matchlen++; + } if (lock) AST_LIST_LOCK(&helpers); while( !ret && (e = cli_next(&i)) ) { -- cgit v1.2.3