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

Re: "pws non-canonical hack" problems



On Aug 23, 11:24am, Alexey I. Froloff wrote:
}
} _path_files:
} 377       # pws non-canonical hack which seems to work so far...
} 378       # if we didn't match by globbing, check that there is
} 379       # something to match by explicit name.  This is for
} 380       # `clever' filing systems where names pop into existence
} 381       # when referenced.
} 382       if (( ! $#tmp1 )); then
} 383           for tmp3 in "$tmp2[@]"; do
} 384               if [[ -n $tmp3 && $tmp3 != */ ]]; then
} 385                   tmp3+=/
} 386               fi
} 387               if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then
} 388                   tmp1+=("$tmp3${(Q)PREFIX}${(Q)SUFFIX}")
} 389               fi
} 390           done
} 391       fi
} 
} When I completing directory, sometimes file is being completed.

The problem is that this code should not unconditionally append something
to tmp1.  It has to test again (probably by using some variant of the call
to compfiles that appears 20 or so lines above) that some new file really
was created that matches the qualifiers in the generated glob pattern.

Really this whole idea of attempting to complete things that don't exist
yet puts a huge amount of overhead on the cases where nothing ever will.

-- 



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