Zsh Mailing List Archive
Messages sorted by:
Re: file completion(?) erases word typed
- X-seq: zsh-workers 39123
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: file completion(?) erases word typed
- Date: Tue, 30 Aug 2016 00:03:31 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=v6FpBLgYTzVtj6REFsBHlEvO3GrTv0Mw17NoscBCRyA=; b=FCt8vH549PJnVZo1cZ/Q6HEGEZ0lqxzqUz0g2Wnk0BbIt15lUkcsxGh4UGDZVvd1EL Dp7hg1URgFmgs8qdESKKB7mWbjy8uzL/RQ+/RZVLOK4QZyXWxq6Ru3dmYP1eF4vjhViP pIIpUULdxfwY7JuQjF5Q2AaMt66Wc6y+Rr/3xTjgTwNOCmVzTBV0l8IVzxHRVPq6g+Cp sVRWTY93S72I51tPZ9R8P5RVnVXM6Ut3qnVogafw3Bwniqxg4dtl3lD80G2ZMbQblroE C9coUvKL0EOgi3uWxvSFt37/2fHNmst/73TKMJuh95NTnIuw3CVIV6uD3QWV2vLDtKnj l5fQ==
- In-reply-to: <20160824191313.GA31943@fujitsu.shahaf.local2>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160823224842.GA24864@fujitsu.shahaf.local2> <160823225204.ZM19950@torch.brasslantern.com> <20160824191313.GA31943@fujitsu.shahaf.local2>
On Aug 24, 7:13pm, Daniel Shahaf wrote:
} I don't know why list-choices would act differently to expand-or-complete.
Some additional clues ...
Using my example (because I don't have gtk-* installed):
torch% f /usr/local/bin/zsh-5<TAB>
Here the word on the line is not yet the longest common prefix of any of
the possible matches. So we enter compresult.c:do_ambiguous() and on
line 786 we delete the entire word on the line, but ainfo->line has a
prefix, which is inserted by cline_str() at line 789. This happens to
be the same word that's already on the line. Because a prefix has
been inserted, the set of matching suffixes is listed.
torch% f /usr/local/bin/zsh-5.<TAB>
We arrive in do_ambiguous() and hit line 786 as before, but this time
the string that was on the line is already the longest common prefix;
so now ainfo->line does NOT have a prefix with which to replace it.
In this case cline_str() should re-insert the original word from the
line, which is present in ainfo->line->orig, but for some reason the
value of ainfo->line->olen is zero, so cline_str() ends up doing
nothng and the erased word is never restored.
ainfo->line->olen appears ultimately to come from add_match_part()
called from match_str() at line 739 of compmatch.c; it's merged from
there into ainfo by join_clines() called from add_match_data(). At
this point, though, I get lost trying to keep track of what's going
on with l + loff and llen (which comes from mp->llen) and ll and all
of Sven's other usefully named variables.
I *think* what it comes down to is that the matcher-list is causing
the path prefix to be mapped to nothing so as to be able to complete
the basename of the command, but because completion wants to wait for
a second tab before starting the menu on ambiguous results, it ends
up throwing away the data that it would need to do anything useful
when that second tab finally arrives.
This hypothesis is supported by the fact that using zstyle to force
entry into menu-selection results in completions being available.
However, I don't know whether the right thing is to recognized that
the prefix is going to end up empty and jump directly into the menu
without looking for the second tab, or to second-guess the matcher
code and re-insert the original word when that fails to do so; or if
there is instead a fix to compmatch.c needed. And I don't presently
have any idea how to implement any of those choices.
Messages sorted by: