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

Re: PATCH: _xwit



In article <rsq7les4hn9.fsf@xxxxxxxxxxxxxxxxx>,
  Tanaka Akira <akr@xxxxxxxxxxx> writes:

> Since I found that `xwit -keyrepeat 10 -<TAB>' runs _message, it is
> fixed as follows.

> -        \( "/[0-9]##$nul/" ":_message keycode" \
> -	  \( "/-$nul/" "/[0-9]##$nul/" ":_message 'last keycode'" \| \) \) \# \
> +        \( "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message keycode" \
> +	  \( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message 'last keycode'" \| \) \) \# \

Oops.  Since [0-9]## doesn't match empty string, `xwit -keyrepeat
<TAB>' didn't show the message.  It should be [0-9]#.

Index: Completion/X/_xwit
===================================================================
RCS file: /projects/zsh/zsh/Completion/X/_xwit,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _xwit
--- Completion/X/_xwit	2000/03/24 13:34:17	1.1.1.3
+++ Completion/X/_xwit	2000/03/24 18:33:43
@@ -39,8 +39,8 @@
     \| "/iconmove$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
     \| "/id$nul/" "$guard" "/$word/" ":_x_window" \
     \| "/(no|)keyrepeat$nul/" "$guard" \
-        \( "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message keycode" \
-	  \( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]## ]] && _message 'last keycode'" \| \) \) \# \
+        \( "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message keycode" \
+	  \( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message 'last keycode'" \| \) \) \# \
     \| "/names$nul/" "$guard" "/$word/" ":_x_window -n" \# \
     \| "/[]/" ':_xwit_compopts' \
     \) \

But, this doesn't work because [[ -prefix [0-9]# ]] is failed even
when $PREFIX is empty:

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { if [[ -prefix [0-9]# ]]; then compadd succ; else compadd fail; fi } 
is27e1u11% tst <TAB>
->
is27e1u11% tst fail 
-- 
Tanaka Akira



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