* PATCH (?) Re: strange completion [not found] ` <4DE765F2.5000704@sergio.spb.ru> @ 2011-06-02 14:13 ` Bart Schaefer 2011-06-03 8:34 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2011-06-02 14:13 UTC (permalink / raw) To: zsh-workers, sergio [>zsh-workers] On Jun 2, 2:29pm, sergio wrote: } Subject: Re: strange completion } } This is list-dirs-first bug. } If I comment this string: } zstyle ':completion:*' list-dirs-first true } all works fine. Hmm; this is actually a problem (?) in _path_files when evaluating the "fake-files" style. I'm not sure whether the following is the correct fix, or whether that entire if/elif/else cascade should be wrapped in if [[ -n "$fake" ]]; then because all the branches pass a (possibly empty) $fake to compfiles. Index: Completion/Unix/Type/_path_files =================================================================== --- Completion/Unix/Type/_path_files 1 Jun 2011 06:39:59 -0000 +++ Completion/Unix/Type/_path_files 2 Jun 2011 14:07:00 -0000 @@ -438,7 +438,7 @@ tmp2=( "$tmp1[@]" ) - if [[ "$tpre$tsuf" = */* ]]; then + if [[ "$tpre$tsuf" = */* && -n "$fake" ]]; then compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake elif [[ "$sopt" = *[/f]* ]]; then compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]" ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH (?) Re: strange completion 2011-06-02 14:13 ` PATCH (?) Re: strange completion Bart Schaefer @ 2011-06-03 8:34 ` Bart Schaefer 2011-09-05 19:11 ` Alexey I. Froloff 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2011-06-03 8:34 UTC (permalink / raw) To: zsh-workers On Jun 2, 7:13am, Bart Schaefer wrote: } } I'm not sure whether the following is the correct fix, or whether that } entire if/elif/else cascade should be wrapped in } } if [[ -n "$fake" ]]; then That last idea is definitely wrong, at the least the "else" branch needs to be taken, but this -- } + if [[ "$tpre$tsuf" = */* && -n "$fake" ]]; then -- is also too much. It's OK for $fake to be empty as long as there is something after the final slash in "$tpre$tsuf". I was mildly surprised to discover that in [[ ... && ... ]] the stuff to the left of the && is evaluated before expanding variables in the stuff to the right of the &&. The question for the patch below is, in [[ foo/bar/ = (#b)*/(*) ]] is $match[1] guaranteed to be empty? Or do I need ([^/]#) to be safe? And jeez, somebody really needs to document compfiles *somewhere*. I recall we didn't want it detailed in the man page doc for some reason, but ... Index: Completion/Unix/Type/_path_files =================================================================== --- Completion/Unix/Type/_path_files 1 Jun 2011 06:39:59 -0000 +++ Completion/Unix/Type/_path_files 3 Jun 2011 08:12:48 -0000 @@ -438,7 +438,7 @@ tmp2=( "$tmp1[@]" ) - if [[ "$tpre$tsuf" = */* ]]; then + if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake elif [[ "$sopt" = *[/f]* ]]; then compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake "$pats[@]" ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH (?) Re: strange completion 2011-06-03 8:34 ` Bart Schaefer @ 2011-09-05 19:11 ` Alexey I. Froloff 2011-09-05 20:42 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Alexey I. Froloff @ 2011-09-05 19:11 UTC (permalink / raw) To: zsh-workers [-- Attachment #1: Type: text/plain, Size: 694 bytes --] On Fri, Jun 03, 2011 at 01:34:07AM -0700, Bart Schaefer wrote: > - if [[ "$tpre$tsuf" = */* ]]; then > + if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then Don't know why, but this patch breaks completion with list-dirs-first set to true (see _files): $ ls .zsh/Completion/<Tab> Sorry. No match for: `files' or `directories' $ ls .zsh/Completion/_<Tab> ---- files ---- _files _path_files However: $ ls <Tab> ---- directories ---- ... ---- files ---- ... As you can see, it refuses to complete files without known prefix. Can someone, please, look into tis issue? -- Regards, -- Sir Raorn. --- http://thousandsofhate.blogspot.com/ [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH (?) Re: strange completion 2011-09-05 19:11 ` Alexey I. Froloff @ 2011-09-05 20:42 ` Bart Schaefer 2011-09-05 21:34 ` Alexey I. Froloff 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2011-09-05 20:42 UTC (permalink / raw) To: zsh-workers On Sep 5, 11:11pm, Alexey I. Froloff wrote: } } On Fri, Jun 03, 2011 at 01:34:07AM -0700, Bart Schaefer wrote: } > - if [[ "$tpre$tsuf" = */* ]]; then } > + if [[ "$tpre$tsuf" = (#b)*/(*) && -n "$fake${match[1]}" ]]; then } Don't know why, but this patch breaks completion with } list-dirs-first set to true (see _files): Try the (not yet committed) patch from zsh-users/16302 and see if that makes any difference? Tangentially related, I've noticed that list-dirs-first doesn't really do anything unless there is a group-name style in effect. That is: % autoload -Uz compinit % compinit -D % zstyle \* list-dirs-first true % ls <TAB> BUILD config.modules local Test/ Completion/ config.modules.sh Makefile typescript Config/ config.status* sleep ul* config.h Doc/ Src/ config.h-xx Etc/ stamp-h config.log Functions/ stamp-h.in % zstyle \* group-name '' % ls <TAB> Completion/ Doc/ Functions/ Test/ Config/ Etc/ Src/ BUILD config.modules Makefile typescript config.h config.modules.sh sleep ul* config.h-xx config.status* stamp-h config.log local stamp-h.in ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH (?) Re: strange completion 2011-09-05 20:42 ` Bart Schaefer @ 2011-09-05 21:34 ` Alexey I. Froloff 0 siblings, 0 replies; 5+ messages in thread From: Alexey I. Froloff @ 2011-09-05 21:34 UTC (permalink / raw) To: zsh-workers [-- Attachment #1: Type: text/plain, Size: 262 bytes --] On Mon, Sep 05, 2011 at 01:42:18PM -0700, Bart Schaefer wrote: > Try the (not yet committed) patch from zsh-users/16302 and see if that > makes any difference? Works fine, thanks. -- Regards, -- Sir Raorn. --- http://thousandsofhate.blogspot.com/ [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-05 21:34 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <4DE6ABF6.10405@sergio.spb.ru> [not found] ` <110601194609.ZM14369@torch.brasslantern.com> [not found] ` <4DE765F2.5000704@sergio.spb.ru> 2011-06-02 14:13 ` PATCH (?) Re: strange completion Bart Schaefer 2011-06-03 8:34 ` Bart Schaefer 2011-09-05 19:11 ` Alexey I. Froloff 2011-09-05 20:42 ` Bart Schaefer 2011-09-05 21:34 ` Alexey I. Froloff
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).