zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: 3.1.6-pws-3: _precommand
@ 1999-09-07 14:48 Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-09-07 14:48 UTC (permalink / raw)
  To: Zsh hackers list

_normal sets _compskip to `pattern' before starting a completion; when
_precommand shifts the input array to start a new normal completion,
that means that pattern completions defined for the new command word
aren't recognised.  I haven't understood all the logic for _compskip
by a long way, but it seems as if it is wrong in this case, at least,
since completing after `noglob' etc. should be exactly the same as if
the precommand word wasn't there.

--- Completion/Base/_precommand~	Tue Apr 13 09:37:36 1999
+++ Completion/Base/_precommand	Tue Sep  7 14:46:04 1999
@@ -3,4 +3,7 @@
 shift words
 (( CURRENT-- ))
 
+# We now want to go back to doing ordinary completion on the new word,
+# so restore the default _compskip.
+_compskip=''
 _normal

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: 3.1.6-pws-3: _precommand
@ 1999-09-08  9:35 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-09-08  9:35 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> _normal sets _compskip to `pattern' before starting a completion; when
> _precommand shifts the input array to start a new normal completion,
> that means that pattern completions defined for the new command word
> aren't recognised.  I haven't understood all the logic for _compskip
> by a long way, but it seems as if it is wrong in this case, at least,
> since completing after `noglob' etc. should be exactly the same as if
> the precommand word wasn't there.

Yes, it's a bit messy, maybe we should think about something more
powerful some day.
Anyway, the problem is that `_compskip' should be reset to an empty
string whenever `_normal' is called from a normal completion function
(not from `_complete'). (At least, I think so, because otherwise
pattern functions aren't used for things like `find . -exec foo <TAB>',
either).

Bye
 Sven

diff -u -r oldcompletion/Base/_precommand Completion/Base/_precommand
--- oldcompletion/Base/_precommand	Wed Sep  8 11:29:45 1999
+++ Completion/Base/_precommand	Wed Sep  8 11:29:55 1999
@@ -3,7 +3,4 @@
 shift words
 (( CURRENT-- ))
 
-# We now want to go back to doing ordinary completion on the new word,
-# so restore the default _compskip.
-_compskip=''
 _normal
diff -u -r oldcompletion/Core/_complete Completion/Core/_complete
--- oldcompletion/Core/_complete	Wed Sep  8 09:03:52 1999
+++ Completion/Core/_complete	Wed Sep  8 11:27:06 1999
@@ -31,7 +31,7 @@
 # For arguments and command names we use the `_normal' function.
 
 if [[ "$compstate[context]" = command ]]; then
-  _normal
+  _normal -s
 else
   # Let's see if we have a special completion definition for the other
   # possible contexts.
diff -u -r oldcompletion/Core/_normal Completion/Core/_normal
--- oldcompletion/Core/_normal	Wed Sep  8 09:03:53 1999
+++ Completion/Core/_normal	Wed Sep  8 11:32:26 1999
@@ -2,6 +2,13 @@
 
 local comp command cmd1 cmd2 pat val name i ret=1 _compskip="$_compskip"
 
+# If we get the option `-s', we don't reset `_compskip'. This ensures
+# that a value set in the function for the `-first-' context is kept,
+# but that we still use pattern functions when we were called form
+# another completion function.
+
+[[ "$1" = -s ]] || _compskip=''
+
 # Completing in command position? If not we set up `cmd1' and `cmd2' as
 # two strings we have to search in the completion definition arrays (e.g.
 # a path and the last path name component).

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-09-08  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-07 14:48 PATCH: 3.1.6-pws-3: _precommand Peter Stephenson
1999-09-08  9:35 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).