mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
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
This commit is contained in:
9
cli.c
9
cli.c
@@ -1313,7 +1313,7 @@ static char *__ast_cli_generator(const char *text, const char *word, int state,
|
|||||||
int matchnum=0;
|
int matchnum=0;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char matchstr[80] = "";
|
char matchstr[80] = "";
|
||||||
int tws;
|
int tws = 0;
|
||||||
char *dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws);
|
char *dup = parse_args(text, &x, argv, sizeof(argv) / sizeof(argv[0]), &tws);
|
||||||
|
|
||||||
if (!dup) /* error */
|
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;
|
argindex = (!ast_strlen_zero(word) && x>0) ? x-1 : x;
|
||||||
/* rebuild the command, ignore tws */
|
/* rebuild the command, ignore tws */
|
||||||
ast_join(matchstr, sizeof(matchstr)-1, argv);
|
ast_join(matchstr, sizeof(matchstr)-1, argv);
|
||||||
if (tws)
|
|
||||||
strcat(matchstr, " "); /* XXX */
|
|
||||||
matchlen = strlen(matchstr);
|
matchlen = strlen(matchstr);
|
||||||
|
if (tws) {
|
||||||
|
strcat(matchstr, " "); /* XXX */
|
||||||
|
if (matchlen)
|
||||||
|
matchlen++;
|
||||||
|
}
|
||||||
if (lock)
|
if (lock)
|
||||||
AST_LIST_LOCK(&helpers);
|
AST_LIST_LOCK(&helpers);
|
||||||
while( !ret && (e = cli_next(&i)) ) {
|
while( !ret && (e = cli_next(&i)) ) {
|
||||||
|
4
pbx.c
4
pbx.c
@@ -2864,8 +2864,10 @@ static char *complete_show_application(const char *line, const char *word, int p
|
|||||||
/* return the n-th [partial] matching entry */
|
/* return the n-th [partial] matching entry */
|
||||||
AST_LIST_LOCK(&apps);
|
AST_LIST_LOCK(&apps);
|
||||||
AST_LIST_TRAVERSE(&apps, a, list) {
|
AST_LIST_TRAVERSE(&apps, a, list) {
|
||||||
if (!strncasecmp(word, a->name, wordlen) && ++which > state)
|
if (!strncasecmp(word, a->name, wordlen) && ++which > state) {
|
||||||
ret = strdup(a->name);
|
ret = strdup(a->name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AST_LIST_UNLOCK(&apps);
|
AST_LIST_UNLOCK(&apps);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user