Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 2/5] bashcompinit: fix COMP_POINT



And add a comment explaining how 'words' changes behavior while we are
no it.

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 Completion/bashcompinit |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index 01cc38b..2d6743e 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -8,7 +8,7 @@ _bash_complete() {
   local COMP_LINE="$words"
   local -A savejobstates savejobtexts
 
-  (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
+  (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
   (( COMP_CWORD = CURRENT - 1))
   COMP_WORDS=( $words )
   BASH_VERSINFO=( 2 05b 0 1 release )
@@ -46,6 +46,7 @@ compgen() {
   local -a name res results jids
   local -A shortopts
 
+  # words changes behavior: words[1] -> words[0]
   emulate -L sh
   setopt kshglob noshglob braceexpand nokshautoload
 
-- 
1.7.8.3



Messages sorted by: Reverse Date, Date, Thread, Author