zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Another _path_files bug?
Date: Thu, 10 Feb 2011 09:28:20 -0800	[thread overview]
Message-ID: <110210092820.ZM30702@torch.brasslantern.com> (raw)
In-Reply-To: <110210084252.ZM30454@torch.brasslantern.com>

On Feb 10,  8:42am, Bart Schaefer wrote:
}
} torch% setopt completeinword
} torch% ls Test/
} torch% ls Test//Test/Makefile
} 
} This only happens when there is only a single completion in the directory.
} If the completion is ambiguous, it works correctly:
} 
} The first significant difference seems to be at around line 740 - 760 of
} _path_files where, in the completeinword case, $mid gets assigned on line
} 749.  I think, but am not yet sure, that when $tsuf contains but does not
} begin with a "/", then at line 754 (and possibly also at line 752, but
} again not sure) $cpre should NOT have a trailing slash appended.

That may or may not be the case, but I've narrowed this down to the compadd
at line 783.  In the failing case, this does:

    compadd -Qf -J -default- -J -default- -p Test/ \
            -s /Makefile -W Test// -M 'r:|/=* r:|=*' - Test

That is, it's attempting to make "Test" one of the completions, and at
the same time assert that "/Makefile" should be a suffix.  The trouble
is that it's also making "Test/" a prefix (-p).

The -p argument is "${Uopt:+$IPREFIX}$linepath$tmp3/" where Uopt and
IPREFIX and linepath are all empty.  tmp3="${mid%/*/}" from line 773,
which is just $mid because "Test/" does not begin with a slash.

I think it's pretty obvious that we don't want to be treating "Test"
as both a completion and a prefix, but we need the -p option in the
event that $linepath is not empty.  Also it's not clear that the final
slash should always be appended to the -p argument as it is there.

What's the right thing to do?


  reply	other threads:[~2011-02-10 17:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 16:42 Bart Schaefer
2011-02-10 17:28 ` Bart Schaefer [this message]
2011-02-11 20:39   ` Peter Stephenson
2011-02-12 22:22     ` Bart Schaefer
2011-02-12 23:03       ` Bart Schaefer
2011-02-13 17:54       ` Peter Stephenson

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=110210092820.ZM30702@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).