zsh-workers
 help / color / mirror / code / Atom feed
* Inconsistent tab completion with 'autocd' option and with 'cd' command
@ 2015-06-26 18:55 Patrick Palka
  2015-06-26 21:47 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2015-06-26 18:55 UTC (permalink / raw)
  To: zsh-workers

Hello,

I noticed that there is a discrepancy between the tab completion of
"cd ../<TAB>" and with the 'autocd' equivalent "../<TAB>".  It seems
that the latter canonicalizes the current path -- resolving symlinks
-- and the former does not which gives different results when the
current path has a symlink component.  Here's a simple test case:

$ setopt autocd
$ mkdir z
$ cd z
$ mkdir -p a/b
$ ln -s a/b c
$ cd c
$ cd ../<TAB>
a/  c@
$ ../<TAB>
b/

In particular I am not a fan of the completion results of the 'autocd'
variant.  It would be nice if the two completion results were
consistent.  Hope this "bug report" is clear and helpful :)


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

* Re: Inconsistent tab completion with 'autocd' option and with 'cd' command
  2015-06-26 18:55 Inconsistent tab completion with 'autocd' option and with 'cd' command Patrick Palka
@ 2015-06-26 21:47 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2015-06-26 21:47 UTC (permalink / raw)
  To: zsh-workers

On Jun 26,  2:55pm, Patrick Palka wrote:
}
} In particular I am not a fan of the completion results of the 'autocd'
} variant.  It would be nice if the two completion results were
} consistent.  Hope this "bug report" is clear and helpful :)

Hmm.  So far, analysis without suggested alteration:

_cd says:

    # Don't complete local directories in command position, that's
    # already handled by _command_names (see _autocd)

_command_names uses:

    _path_files -/g \*\(-\*\)

This will follow ".." literally up to z/a rather than symbolically
up to z, so ../c is not a possible path.

Whereas _cd uses:

    _path_files $tmpWpath -/

where $tmpWpath is computed by a messy hack that forks a subshell to
actually preflight the "cd" to be sure CHASE_LINKS etc. is properly
managed.

This makes no difference unless you're using "../" somewhere in the
string in command position *and* there are no executable files in
the directory to which you are attempting to autocd.

Also your specific example is quite often suppressed for "cd" by the
ignore-parents style.


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

end of thread, other threads:[~2015-06-26 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 18:55 Inconsistent tab completion with 'autocd' option and with 'cd' command Patrick Palka
2015-06-26 21:47 ` Bart Schaefer

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