From a3e51c1db72a406ff7cc7741c9b5dc18b50e3c14 Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Mon, 1 Apr 2002 16:50:05 +0000 Subject: [PATCH] - _command(): when passing off command lines for subcompletion by other functions, we were passing incorrect information about the current line position when the command line contained wildcards that expanded arguments to multiple arguments --- bash_completion | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index 2a53bb41..888aa704 100644 --- a/bash_completion +++ b/bash_completion @@ -1,6 +1,6 @@ # bash_completion - some programmable completion functions for bash 2.05a # -# $Id: bash_completion,v 1.241 2002/04/01 16:45:45 ianmacd Exp $ +# $Id: bash_completion,v 1.242 2002/04/01 18:50:05 ianmacd Exp $ # # Copyright (C) Ian Macdonald # @@ -1735,8 +1735,6 @@ _command() # so we can set them before handing off to regular # completion routine - # set current token number to 1 less than now - COMP_CWORD=$(( $COMP_CWORD - 1 )) # get function name func=${cspec#*-F } func=${func%% *} @@ -1744,6 +1742,9 @@ _command() cline="${COMP_LINE#$1 }" # split current command line tokens into array COMP_WORDS=( $cline ) + # set current token number to 1 less than expanded line + COMP_CWORD=$(( ${#COMP_WORDS[@]} - 1 )) + cur=${COMP_WORDS[COMP_CWORD]} $func $cline # remove any \: generated by a command that doesn't # default to filenames or dirnames (e.g. sudo chown)