From e8ce775db824de329b81293b4e5d8fbd65624528 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Mon, 22 Sep 1997 20:22:27 +0000 Subject: Imported from ../bash-2.01.1.tar.gz. --- bashline.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'bashline.c') diff --git a/bashline.c b/bashline.c index fbd196a..4feb7be 100644 --- a/bashline.c +++ b/bashline.c @@ -700,8 +700,8 @@ attempt_shell_completion (text, start, end) /* Check that we haven't incorrectly flagged a closed command substitution as indicating we're in a command position. */ - if (in_command_position && rl_line_buffer[ti] == '`' && *text != '`' && - unclosed_pair (rl_line_buffer, 0, "`") == 0) + if (in_command_position && ti >= 0 && rl_line_buffer[ti] == '`' && + *text != '`' && unclosed_pair (rl_line_buffer, 0, "`") == 0) in_command_position = 0; /* Special handling for command substitution. If *TEXT is a backquote, @@ -744,7 +744,16 @@ attempt_shell_completion (text, start, end) /* This could be a globbing pattern, so try to expand it using pathname expansion. */ if (!matches && glob_pattern_p (text)) - matches = completion_matches (text, glob_complete_word); + { + matches = completion_matches (text, glob_complete_word); + /* A glob expression that matches more than one filename is problematic. + If we match more than one filename, punt. */ + if (matches && matches[1]) + { + free_array (matches); + matches = (char **)0; + } + } return (matches); } @@ -1801,6 +1810,7 @@ glob_complete_word (text, state) if (state == 0) { + rl_filename_completion_desired = 1; if (matches) free (matches); matches = shell_glob_filename (text); -- cgit v1.2.3