zsh-users
 help / color / mirror / code / Atom feed
* Completion of dirs confused over cursor position
@ 2003-01-08 19:46 Phil Pennock
  2003-01-09 10:42 ` Peter Stephenson
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Pennock @ 2003-01-08 19:46 UTC (permalink / raw)
  To: zsh-users

Owing to a major machine failure and not being able to get my old data
back for a few more days, I've finally taken the plunge and tried moving
away from compctl.

Very impressive.

However, if I "cd <TAB>", I get shown:
 Completing directory
 Mail/  bin/ 

typing "b<TAB>" gives me a command-line of "cd bin/"; pressing <TAB>
again here shows the available completions, but puts the cursor back
_before_ the "/"; pressing tab will cycle through the options, but I
can't type the first letter and then tab again, since I'm then changing
the name before the "/".

What am I missing?  There must be some tunable which handles this
conflict ...

Thanks,


Elided config follows.

zsh 4.0.6, OpenBSD 3.2 on sparc.

setopt autocd autolist automenu braceccl extendedglob interactivecomments
setopt listambiguous listtypes multios numericglobsort rcexpandparam
bindkey -e

PS1=': %2(L.%U[%L]%u.)%(?..%B{%v}%b)%(2v:<+%2v>:-)%n@%2m:%l[%T](%!)%37<..<%~%<<%#; '
unset RPS1
function precmd {
	local exitstatus=$?
	psvar[1]=SIG
	[[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
	[[ $psvar[1] == SIG ]] && psvar[1]=$exitstatus
	psvar[2]=$#jobstates; [[ $psvar[2] -eq 0 ]] && psvar[2]=()
}

# The following lines were added by compinstall

zstyle ':completion:*' auto-description 'requires: %d'
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' ignore-parents parent pwd ..
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p
 \[%l\]%s
zstyle ':completion:*' squeeze-slashes true
zstyle :compinstall filename '/home/phil/.zshrc'

autoload -U compinit
compinit
# End of lines added by compinstall


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

* Re: Completion of dirs confused over cursor position
  2003-01-08 19:46 Completion of dirs confused over cursor position Phil Pennock
@ 2003-01-09 10:42 ` Peter Stephenson
  2003-01-09 14:51   ` Phil Pennock
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2003-01-09 10:42 UTC (permalink / raw)
  To: zsh-users

Phil Pennock wrote:
> Owing to a major machine failure and not being able to get my old data
> back for a few more days, I've finally taken the plunge and tried moving
> away from compctl.
> 
> Very impressive.
> 
> However, if I "cd <TAB>", I get shown:
>  Completing directory
>  Mail/  bin/ 
> 
> typing "b<TAB>" gives me a command-line of "cd bin/"; pressing <TAB>
> again here shows the available completions, but puts the cursor back
> _before_ the "/"; pressing tab will cycle through the options, but I
> can't type the first letter and then tab again, since I'm then changing
> the name before the "/".

This isn't supposed to happen and doesn't when I use your settings.
Maybe some invisible character is screwing up the calculations.  I think
you're stuck with trying to find the minimum set of options, styles and
parameters which reproduces it, also whether it's specific to a
particular version or displaying a particular arrangement of filenames.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


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

* Re: Completion of dirs confused over cursor position
  2003-01-09 10:42 ` Peter Stephenson
@ 2003-01-09 14:51   ` Phil Pennock
  2003-01-09 15:02     ` Borzenkov Andrey
  2003-01-09 18:35     ` Bart Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: Phil Pennock @ 2003-01-09 14:51 UTC (permalink / raw)
  To: zsh-users

On 2003-01-09 at 10:42 +0000, Peter Stephenson wrote:
> This isn't supposed to happen and doesn't when I use your settings.
> Maybe some invisible character is screwing up the calculations.  I think
> you're stuck with trying to find the minimum set of options, styles and
> parameters which reproduces it, also whether it's specific to a
> particular version or displaying a particular arrangement of filenames.

Well, the exact same _config_ for another user on the same box did not
have that effect.  However, playing around with directories, I do see
issues.

 .
 ./bin
 ./bin/common
 ./bin/openbsd_sparc

Then "cd <TAB><TAB>" shows the issue.  I've not tracked down the exact
combination of filename layout, but it seems to be connected to the
underscore.  Commenting out the matcher-list item removes the issue:

# zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*'

I'm sorry that my diagnosis of this stuff is so poor.  I've avoided the
new completion stuff, and am having serious head-scratching moments
trying to figure out how to replicate some old compctl stuff.  Even
simple things, like:
 compctl -f -W ~/some/directory commandname

The FAQ still points to compctl usage.  This is not my week.

(aargh, I can no longer rely upon $_ as being usable. :^( )


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

* RE: Completion of dirs confused over cursor position
  2003-01-09 14:51   ` Phil Pennock
@ 2003-01-09 15:02     ` Borzenkov Andrey
  2003-01-09 16:06       ` Phil Pennock
  2003-01-09 18:35     ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: Borzenkov Andrey @ 2003-01-09 15:02 UTC (permalink / raw)
  To: 'Phil Pennock', zsh-users


> I'm sorry that my diagnosis of this stuff is so poor.  I've avoided the
> new completion stuff, and am having serious head-scratching moments
> trying to figure out how to replicate some old compctl stuff.  Even
> simple things, like:
>  compctl -f -W ~/some/directory commandname
> 

hmm ...

function _foo {
	_files -W /some/directory
}
compadd _foo commandname

does it work?

And doing it automatically:

echo > ~/functions/_foo << EOF
#compadd commandname
_files -W /some/directory
EOF

fpath=($fpath ~/functions)
compinit

the last part obviously goes into .zshrc or whatever. Try running
compinstall as well.

-andrey

> The FAQ still points to compctl usage.  This is not my week.
> 
> (aargh, I can no longer rely upon $_ as being usable. :^( )


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

* RE: Completion of dirs confused over cursor position
  2003-01-09 16:06       ` Phil Pennock
@ 2003-01-09 16:01         ` Borzenkov Andrey
  0 siblings, 0 replies; 8+ messages in thread
From: Borzenkov Andrey @ 2003-01-09 16:01 UTC (permalink / raw)
  To: 'Phil Pennock', zsh-users

> On 2003-01-09 at 18:02 +0300, Borzenkov Andrey wrote:
> > function _foo {
> > 	_files -W /some/directory
> > }
> > compadd _foo commandname
> >
> > does it work?
> 
> No:
>  compadd: can only be called from completion function
> 

compdef. Shame on me :(

bor@itsrm2% compdef _foo foo
bor@itsrm2% function _foo { _files -W ~/test }
bor@itsrm2% foo a\ b/
Completing file
a\ b/      c\\\ d/    radius/    uudecode/

> However, that's looking much simpler than anything in the manual pages
> or the examples I looked at in the distributed completions.  :^)  I was
> getting lost in functions calling functions calling functions
> maintaining various levels of state, with reference man-pages and no
> tutorial.
> 
> Is there a tutorial somewhere which I've missed? 

http://zsh.sunsite.dk/Guide/

 The manual pages are
> some of the most daunting I've seen.  I do read manual-pages, but
> looking at these I can't get a mental handle on the frameword and what
> fits where, to get started.
> 

what we need is splitting current documentation into development guide and
user stuff. Completion manual pages are more of the former but they lack too
much to be of any real use. And average user needs mostly just _arguments,
_files and possibly _values to generate own completions and exactly these
have to poor documentation (and nightmare syntax :)).

-andrej

> > And doing it automatically:
> >
> > echo > ~/functions/_foo << EOF
> > #compadd commandname
> > _files -W /some/directory
> > EOF
> 
> That general structure I had (although I suspect that you meant cat,
> since echo doesn't use its stdin).

Urgh :))

  And the supplied versions use
> "#compdef".  If I use "#compadd", it's not auto-loaded.
> 
> > fpath=($fpath ~/functions)
> > compinit
> 
> And that I had.
> 
> > the last part obviously goes into .zshrc or whatever. Try running
> > compinstall as well.
> 
> Yup, tried that.
> 
> Okay, logging in again, forcing a rebuild of .zcompdump (after changing
> to "#compdef", it now works.  :^)
> 
> Thanks,
> 
> -Phil


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

* Re: Completion of dirs confused over cursor position
  2003-01-09 15:02     ` Borzenkov Andrey
@ 2003-01-09 16:06       ` Phil Pennock
  2003-01-09 16:01         ` Borzenkov Andrey
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Pennock @ 2003-01-09 16:06 UTC (permalink / raw)
  To: zsh-users

On 2003-01-09 at 18:02 +0300, Borzenkov Andrey wrote:
> function _foo {
> 	_files -W /some/directory
> }
> compadd _foo commandname
> 
> does it work?

No:
 compadd: can only be called from completion function

However, that's looking much simpler than anything in the manual pages
or the examples I looked at in the distributed completions.  :^)  I was
getting lost in functions calling functions calling functions
maintaining various levels of state, with reference man-pages and no
tutorial.

Is there a tutorial somewhere which I've missed?  The manual pages are
some of the most daunting I've seen.  I do read manual-pages, but
looking at these I can't get a mental handle on the frameword and what
fits where, to get started.

> And doing it automatically:
> 
> echo > ~/functions/_foo << EOF
> #compadd commandname
> _files -W /some/directory
> EOF

That general structure I had (although I suspect that you meant cat,
since echo doesn't use its stdin).  And the supplied versions use
"#compdef".  If I use "#compadd", it's not auto-loaded.

> fpath=($fpath ~/functions)
> compinit

And that I had.

> the last part obviously goes into .zshrc or whatever. Try running
> compinstall as well.

Yup, tried that.

Okay, logging in again, forcing a rebuild of .zcompdump (after changing
to "#compdef", it now works.  :^)

Thanks,

-Phil


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

* Re: Completion of dirs confused over cursor position
  2003-01-09 14:51   ` Phil Pennock
  2003-01-09 15:02     ` Borzenkov Andrey
@ 2003-01-09 18:35     ` Bart Schaefer
  2003-01-10 13:58       ` Phil Pennock
  1 sibling, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2003-01-09 18:35 UTC (permalink / raw)
  To: zsh-users

On Jan 9,  2:51pm, Phil Pennock wrote:
}
} Well, the exact same _config_ for another user on the same box did not
} have that effect.  However, playing around with directories, I do see
} issues.
} 
}  .
}  ./bin
}  ./bin/common
}  ./bin/openbsd_sparc
} 
} Then "cd <TAB><TAB>" shows the issue.  I've not tracked down the exact
} combination of filename layout, but it seems to be connected to the
} underscore.

I suspect this may have something to do with zsh-workers/17906 and its
follow-up, zsh-workers/17910.  You could at least try applying the patch
from 17910, if you aren't already using 4.1.0-dev-whatever.

-- 
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] 8+ messages in thread

* Re: Completion of dirs confused over cursor position
  2003-01-09 18:35     ` Bart Schaefer
@ 2003-01-10 13:58       ` Phil Pennock
  0 siblings, 0 replies; 8+ messages in thread
From: Phil Pennock @ 2003-01-10 13:58 UTC (permalink / raw)
  To: zsh-users

On 2003-01-09 at 18:35 +0000, Bart Schaefer wrote:
> I suspect this may have something to do with zsh-workers/17906 and its
> follow-up, zsh-workers/17910.  You could at least try applying the patch
> from 17910, if you aren't already using 4.1.0-dev-whatever.

It's a sparc 4 -- I use the prebuilt binary packages from the release
CDs (OpenBSD 3.2).  :^)  I've been too spoilt by modern CPUs ...

Okay, I've tried the change from:
 <URL:http://www.zsh.org/mla/workers/2002/msg01319.html>
(which should be zsh-workers/17910); the changed line is 461, as per
your mail, Bart.

It hasn't fixed the problem.  I tried reloading the function, then I
logged out and in again to ensure that the shell reloaded all functions
appropriately.

To be honest, I just commented out the zstyle line, since it was only
picked up by exploring the compinstall menus and going "oooh, shiny!".
So it's not currently affecting me unless I explictly try to test.  I'm
happy to test ideas, but is anyone else even seeing this behaviour?

-Phil


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

end of thread, other threads:[~2003-01-10 13:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-08 19:46 Completion of dirs confused over cursor position Phil Pennock
2003-01-09 10:42 ` Peter Stephenson
2003-01-09 14:51   ` Phil Pennock
2003-01-09 15:02     ` Borzenkov Andrey
2003-01-09 16:06       ` Phil Pennock
2003-01-09 16:01         ` Borzenkov Andrey
2003-01-09 18:35     ` Bart Schaefer
2003-01-10 13:58       ` Phil Pennock

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).