zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Broken specialsed file completion
Date: Mon, 29 Aug 2016 00:56:26 +0200	[thread overview]
Message-ID: <8760qkqz8l.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <20160828222112.0433a930@ntlworld.com> (Peter Stephenson's message of "Sun, 28 Aug 2016 22:21:12 +0100")

Hi,

Peter Stephenson wrote:
> For some reason the following, which has worked fine for many years, has
> stopped working.
>
> zle -C most-recent-file menu-complete _generic
> zstyle ':completion:most-recent-file:*' completer _menu _path_files _match
> zstyle ':completion:most-recent-file:*' file-sort modification
> zstyle ':completion:most-recent-file:*' hidden all
> bindkey '^X.' most-recent-file
>
> Instead of completing most recently modified files, it reports
>
> _path_files:compfiles:466: too few arguments


I had a bit of time on my hands, so I bisected this down to this commit:

    f7c3aa170b8c36b146ba7644cf3912cb1329a5d2 is the first bad commit
    commit f7c3aa170b8c36b146ba7644cf3912cb1329a5d2
    Author: Barton E. Schaefer <schaefer@zsh.org>
    Date:   Wed Aug 10 18:33:04 2016 -0700

    39019 (cf. PWS 39013): fix SHWORDSPLIT regression introduced by workers/29313

    Also add test cases for more join/split combinations


There is one hunk that changes code in that diff:

diff --git a/Src/subst.c b/Src/subst.c
index e3af156..ae3e4c4 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -3454,13 +3454,22 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
      * exception is that ${name:-word} and ${name:+word} will have already
      * done any requested splitting of the word value with quoting preserved.
      */
-    if (ssub || (spbreak && isarr >= 0) || spsep || sep) {
+    if (ssub || spbreak || spsep || sep) {
+       int force_split = !ssub && (spbreak || spsep);
        if (isarr) {
-           val = sepjoin(aval, sep, 1);
-           isarr = 0;
-           ms_flags = 0;
+           if (nojoin == 0) {
+               val = sepjoin(aval, sep, 1);
+               isarr = 0;
+               ms_flags = 0;
+           } else if (force_split && nojoin == 2) {
+               /* Hack to simulate splitting individual elements:
+                * first join on what we later use to split
+                */
+               val = sepjoin(aval, spsep, 1);
+               isarr = 0;
+           }
        }
-       if (!ssub && (spbreak || spsep)) {
+       if (force_split && !isarr) {
            aval = sepsplit(val, spsep, 0, 1);
            if (!aval || !aval[0])
                val = dupstring("");


Maybe that is useful to someone who knows that code.


Regards, Frank


  reply	other threads:[~2016-08-28 23:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-28 21:21 Peter Stephenson
2016-08-28 22:56 ` Frank Terbeck [this message]
2016-08-29  2:01   ` Bart Schaefer
2016-08-29 19:30     ` 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=8760qkqz8l.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=p.w.stephenson@ntlworld.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).