zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH _cd: completion fails for "cd .." if $PWD/.. contains a space
Date: Sat, 28 Dec 2013 00:00:41 -0800	[thread overview]
Message-ID: <131228000041.ZM25439@torch.brasslantern.com> (raw)
In-Reply-To: <8C206EB3503E4B9FAF437799DFF051CD@fueledbylemons.com>

On Dec 27,  9:15pm, Alexey Bezhan wrote:
}
} There's a bug in _cd completion that results in empty result when trying to
} complete after "cd ../" if there's a space somewhere in $PWD/..
} 
} The following patch fixes the space issue, but there may be other cases that
} cause the same behavior that aren't fixed by this change.
} 
} - tmpWpath=(-W $tmpprefix)
} + tmpWpath=(-W \"$tmpprefix\")

Thanks ... your patch seems to have been slightly mangled in transit.

After looking at this for a while I think you are close, but not quite
right.  There are two uses of $tmpWpath, but I believe only one of them
needs additional quoting.

This also needs to be careful to quote each element of the array before
the elements are joined, because the reference is inside double-quotes.


diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd
index a5d328f..b9860ff 100644
--- a/Completion/Zsh/Command/_cd
+++ b/Completion/Zsh/Command/_cd
@@ -100,7 +100,7 @@ else
     # already handled by _command_names (see _autocd)
 
     [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] &&
-        alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files $tmpWpath -/" "$alt[@]" )
+        alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files ${(j: :)${(@q)tmpWpath}} -/" "$alt[@]" )
 
     if [[ CURRENT -eq argstart && noopts -eq 0 && $PREFIX = -* ]] &&
       zstyle -t ":completion:${curcontext}:options" complete-options; then


  reply	other threads:[~2013-12-28  8:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11 19:14 Compatibility issue in the _django completion Alexey Bezhan
2013-12-27 21:15 ` PATCH _cd: completion fails for "cd .." if $PWD/.. contains a space Alexey Bezhan
2013-12-28  8:00   ` Bart Schaefer [this message]
2013-12-30  9:23     ` PATCH _cd: completion fails for Carlo
2013-12-30 16:13       ` Carlo
2013-12-30 16:15       ` Carlo
2013-12-30 19:29         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=131228000041.ZM25439@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).