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

Re: Bug#377765: zsh: completion of configure script does not handle underscore properly



On Thu, 13 Dec 2007 14:09:09 -0500
Clint Adams <schizo@xxxxxxxxxx> wrote:
> This still seems to be an issue and that patch no longer applies to
> current _arguments.

I would imagine something simple-minded like the following would do this
consistently.  Please commit it if it works.

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.20
diff -u -r1.20 _arguments
--- Completion/Base/Utility/_arguments	16 Feb 2007 15:02:03 -0000	1.20
+++ Completion/Base/Utility/_arguments	13 Dec 2007 20:56:36 -0000
@@ -97,7 +97,7 @@
        # present.  Maybe the problem was that the intervening code
        # didn't.  If it's buggy without removing them, the problem
        # probably is later, not here.
-       if [[ -z ${tmp[(r)${match[1]%%[^a-zA-Z0-9-]#}]} ]]; then
+       if [[ -z ${tmp[(r)${match[1]%%[^a-zA-Z0-9_-]#}]} ]]; then
 	 tmp+=($match[1])
        fi
        opt=$match[2]
@@ -218,9 +218,9 @@
 	    odescr=
 	  fi
 	  if [[ $opt = (#b)(*)\[\=* ]]; then
-	    opt2=${${match[1]}//[^a-zA-Z0-9-]}=-${dir}${odescr}
+	    opt2=${${match[1]}//[^a-zA-Z0-9_-]}=-${dir}${odescr}
 	  else
-	    opt2=${${opt}//[^a-zA-Z0-9-]}=${dir}${odescr}
+	    opt2=${${opt}//[^a-zA-Z0-9_-]}=${dir}${odescr}
 	  fi
 	  if [[ "$descr" = :\=* ]]; then
 	    cache+=( "${opt2}::${(L)${opt%\]}#*\=}: " )
@@ -247,7 +247,7 @@
 	  else
 	    odescr=
 	  fi
-	  opt2="${${opt%%\=*}//[^a-zA-Z0-9-]}=${dir}${odescr}"
+	  opt2="${${opt%%\=*}//[^a-zA-Z0-9_-]}=${dir}${odescr}"
 	  if [[ "$descr" = :\=* ]]; then
 	    cache+=( "${opt2}:${(L)${opt%\]}#*\=}: " )
 	  else
@@ -268,7 +268,7 @@
 	  # I discovered after about half an hour, so don't do that.
 	  "${(@)^${(@)tmp:#^*:*}//:/[}]"
 	  # commands with no description
-	  "${(@)${(@)tmp:#*:*}//[^a-zA-Z0-9-]}")
+	  "${(@)${(@)tmp:#*:*}//[^a-zA-Z0-9_-]}")
         if [[ -n "$descr" && "$descr" != ': :  ' ]]; then
 	  cache+=( "${(@)^tmp}${descr}" )
         else

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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