Skip to content

Commit

Permalink
_command_offset: Restore compopts properly (Alioth: #313890)
Browse files Browse the repository at this point in the history
This commit is basicaly a more robust version of 5051b17, which made
invalid assumptions about a completion specification.
  • Loading branch information
GArik committed Nov 6, 2012
1 parent 370b7a0 commit 2472fad
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -1700,16 +1700,13 @@ _command_offset()
fi

# restore initial compopts
local opt t
while true; do
local opt
while [[ $cspec == *" -o "* ]]; do
# FIXME: should we take "+o opt" into account?
t=${cspec#*-o }
if [[ $t == $cspec ]]; then
break
fi
opt=${t%% *}
cspec=${cspec#*-o }
opt=${cspec%% *}
compopt -o $opt
cspec=${t#$opt}
cspec=${cspec#$opt}
done
else
cspec=${cspec#complete}
Expand Down

0 comments on commit 2472fad

Please sign in to comment.