zsh-workers
 help / color / mirror / code / Atom feed
* zcompsys space character problem
@ 2002-11-05  3:27 Frank v Waveren
  2002-11-05  5:10 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Frank v Waveren @ 2002-11-05  3:27 UTC (permalink / raw)
  To: zsh-workers

I've noticed a bug (at least I think it is, with zsh it often turns
out to be a feature so complex you don't recognise it) in zcompsys.

To reproduce:
autoload -U compinit
compinit
mkdir "a a"
mkdir "a aa"
touch "a a/foo"
touch "a aa/foo"

now typing 'ls a\ a/f' and hitting tab (bound to expand-or-complete)
will not complete 'foo' but will jump to the cursor to the /. Repeated
application of tab will try to complete the 'a a' in some options
defined way. However, if the directories are called 'aa' and 'aaa'
(without spaces) zsh behaves as expected and completes to foo if tab
is hit.

This has been tested using zsh 4.1.0-dev-5, using no startup files.

Please CC me, I'm not on the list.

-- 
Frank v Waveren                                      Fingerprint: 21A7 C7F3
fvw@[var.cx|stack.nl|dse.nl|chello.nl] ICQ#10074100     1FF3 47FF 545C CB53
Public key: hkp://wwwkeys.pgp.net/fvw@var.cx            7BD9 09C0 3AC1 6DF2


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

* Re: zcompsys space character problem
  2002-11-05  3:27 zcompsys space character problem Frank v Waveren
@ 2002-11-05  5:10 ` Bart Schaefer
  2002-11-05 12:36   ` Sven Wischnowsky
  2002-11-06  8:03   ` Sven Wischnowsky
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Schaefer @ 2002-11-05  5:10 UTC (permalink / raw)
  To: Frank v Waveren, zsh-workers

This has something to do with `compfiles'.  Comparing the _complete_debug
output for `ls a\ a/f' vs. `ls aa/f' shows (they're the same up to line
461 of _path_files):

: _path_files:461:for while; compfiles -r tmp1 a\ a/f
: _path_files:462:for while; tmp4=1 
: _path_files:464:for while if; [[ a\ a/f == */* ]]
: _path_files:465:for while then; tmp2=a\ a 
: _path_files:466:for while then; PREFIX=a\ a 
: _path_files:467:for while then; SUFFIX=/f 
: _path_files:478:for while if; ((  tmp4  ))
: _path_files:486:for while then; tmp2= 
: _path_files:487:for while then if; [[ -n  ]]
: _path_files:489:for while then elif; [[ -n  ]]
: _path_files:493:for while then else; compquote tmp1 tmp2

			: _path_files:461:for while; compfiles -r tmp1 aa/f
			: _path_files:462:for while; tmp4=0 
			: _path_files:464:for while if; [[ aa/f == */* ]]
			: _path_files:465:for while then; tmp2=aa 
			: _path_files:466:for while then; PREFIX=aa 
			: _path_files:467:for while then; SUFFIX=/f 
			: _path_files:478:for while if; ((  tmp4  ))
			: _path_files:562:for while if; [[ aa/f != */* ]]
			: _path_files:570:for while; testpath=aa/ 
			: _path_files:572:for while; tmp3=f 

Note how the code branches differently at line 478 because `compfiles'
fails at line 461 in the case with the space.

Changing line 461 from

	compfiles -r tmp1 "$tmp3"

to

	compfiles -r tmp1 "${(Q)tmp3}"

has the desired effect in this particular case, but I don't know if it is
always correct.  Sven, are you out there?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: zcompsys space character problem
  2002-11-05  5:10 ` Bart Schaefer
@ 2002-11-05 12:36   ` Sven Wischnowsky
  2002-11-06  8:03   ` Sven Wischnowsky
  1 sibling, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2002-11-05 12:36 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> Changing line 461 from
> 
> 	compfiles -r tmp1 "$tmp3"
> 
> to
> 
> 	compfiles -r tmp1 "${(Q)tmp3}"
> 
> has the desired effect in this particular case, but I don't know if it is
> always correct.  Sven, are you out there?

Yes, I am. I'll try to have a look at it this evening.


Bye
  Sven

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

* Re: zcompsys space character problem
  2002-11-05  5:10 ` Bart Schaefer
  2002-11-05 12:36   ` Sven Wischnowsky
@ 2002-11-06  8:03   ` Sven Wischnowsky
  1 sibling, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2002-11-06  8:03 UTC (permalink / raw)
  To: zsh-workers, Frank v Waveren


Bart Schaefer wrote:

> ...
> 
> Changing line 461 from
> 
> 	compfiles -r tmp1 "$tmp3"
> 
> to
> 
> 	compfiles -r tmp1 "${(Q)tmp3}"
> 
> has the desired effect in this particular case, but I don't know if it is
> always correct.  Sven, are you out there?

I wasn't sure if it weren't better to put this into the C-code, but
leaving it in the shell code seems much more flexible (and, somehow,
logical).

Below is Bart's suggestion put into a patch which I'm goinh to commit.


Bye
  Sven

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.19
diff -u -r1.19 _path_files
--- Completion/Unix/Type/_path_files	2 Jul 2002 14:06:49 -0000	1.19
+++ Completion/Unix/Type/_path_files	6 Nov 2002 07:55:34 -0000
@@ -464,7 +464,7 @@
     # names. This avoids having `foo' complete to `foo' and `foobar'.
     # The return value is non-zero if the component is ambiguous.
 
-    compfiles -r tmp1 "$tmp3"
+    compfiles -r tmp1 "${(Q)tmp3}"
     tmp4=$?
 
     if [[ "$tpre" = */* ]]; then

-- 
Sven Wischnowsky                          wischnow@berkom.de


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

end of thread, other threads:[~2002-11-06  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05  3:27 zcompsys space character problem Frank v Waveren
2002-11-05  5:10 ` Bart Schaefer
2002-11-05 12:36   ` Sven Wischnowsky
2002-11-06  8:03   ` 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).