Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Broken specialsed file completion



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@xxxxxxx>
    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



Messages sorted by: Reverse Date, Date, Thread, Author