- _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
This commit is contained in:
parent
9eb37822a5
commit
a3e51c1db7
@ -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 <ian@caliban.org>
|
||||
#
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user