zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: completion after < at the start of the line
Date: Wed, 28 Mar 2007 15:29:55 +0100	[thread overview]
Message-ID: <20070328152955.8a64af07.pws@csr.com> (raw)
In-Reply-To: <20070327213726.GF4885@sc.homeunix.net>

Stephane Chazelas <Stephane_Chazelas@yahoo.fr> wrote:
> $ mkdir 1
> $ cd 1
> $ touch foo bar
> $ zsh -f
> sc% < b<TAB> foo
> 
> (That is type "< b foo" move the cursor back to 4rd character,
> then type <Tab>)
> 
> Then zsh completes that to:
> 
> sc% < foo foo
> 
> (instead of expected < bar foo).

Good news:  I know why this happens.  Bad news: it's in get_comp_string(),
one of the world's most impenetrable functions (but you should see
set_comp_sep()).

We reset the index into the completion words to zero when the command word
arrives.  Obviously this is wrong in this case since the argument to the
redirection is already there and this overwrites it.  However, not setting it to zero at that point is too simple a fix since it messes up handling of multiple commands on a line separated by ";" etc. etc.

Unfortunately the handling of the index into the array of words is obscured
by one of those typical variables (here called "ins") which gets set to
apparently random values in random places in the function, is used in tests
all over the place so you're never quite sure what's going on, and is
completely undocumented.  If we could work out that was doing (and,
ideally, document it, although I'm not sure the words don't magically drift
off the editor into space if you try) we might be able to work out how to
reset the start of line index.

An alternative strategy is to record redirections before the command word,
but I'd rather understand what's there at present than bolt something new
on regardless.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


  reply	other threads:[~2007-03-28 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 21:37 Stephane Chazelas
2007-03-28 14:29 ` Peter Stephenson [this message]
2007-03-28 21:25   ` Peter Stephenson
2007-03-29 21:25     ` 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=20070328152955.8a64af07.pws@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).