For whatever reason COMPREPLY[${#COMPREPLY[@]}]=foo does not safely update
COMPREPLY, use var++ instead.