From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19177 invoked from network); 13 Aug 2006 17:41:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Aug 2006 17:41:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 43807 invoked from network); 13 Aug 2006 17:41:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Aug 2006 17:41:47 -0000 Received: (qmail 8343 invoked by alias); 13 Aug 2006 17:41:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22601 Received: (qmail 8333 invoked from network); 13 Aug 2006 17:41:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Aug 2006 17:41:43 -0000 Received: (qmail 43526 invoked from network); 13 Aug 2006 17:41:43 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 13 Aug 2006 17:41:42 -0000 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20060813174141.VMOC1865.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sun, 13 Aug 2006 18:41:41 +0100 Received: from pwslaptop.csr.com ([81.107.41.155]) by aamtaout01-winn.ispmail.ntl.com with ESMTP id <20060813174140.PVEH644.aamtaout01-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Sun, 13 Aug 2006 18:41:40 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.7/8.13.7) with ESMTP id k7DHfcw2024024 for ; Sun, 13 Aug 2006 18:41:39 +0100 Message-Id: <200608131741.k7DHfcw2024024@pwslaptop.csr.com> From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: _list_files with quoted characters (etc.) Date: Sun, 13 Aug 2006 18:41:38 +0100 The file-list style doesn't work when the file name has characters that have been quoted for inserting into the command line. The obvious piece of unquoting appears to fix it. On a completely separate completion matter, only I'm lazy, there's still a subtle bug in zsh/complist when scrolling is active (i.e. not all completions fit on the screen) with lines that wrap (i.e. are larger than the column width). It's OK when scrolling forwards (i.e. down, since across won't be possible in this case), but if you attempt to scroll back up from the line after the wrapping line, instead of showing you the wrapping line it repeats the line you were just on. Then you're stuck at that point; you can't go up further. This only happens after you've scrolled the screen---moving down to the line and then back up without scrolling doesn't trigger it---and then only when the wrapping line was already on the screen---if you were at the top of the screen, with the wrapping line off, and move up onto it so that it appears it's OK. Given this is the most complicated case---the completions don't fit in two directions at once---and given it's not that easy to trigger, and given I've been tinkering with the whole thing without really understanding it, this could be a whole lot worse. However, having once crawled out of the jungle and sat down to sip my G&T on the verandah, with the distant but sinister sounds of wild animals emerging as twilight descends, I'm not sure when I'll feel like getting out my machete again. O hear the call! Good Hunting, All That keep the Jungle Law! Index: Completion/Unix/Type/_list_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_list_files,v retrieving revision 1.2 diff -u -r1.2 _list_files --- Completion/Unix/Type/_list_files 12 May 2006 14:58:43 -0000 1.2 +++ Completion/Unix/Type/_list_files 13 Aug 2006 17:25:45 -0000 @@ -8,7 +8,7 @@ # Sets array listfiles to the display strings and the array # listopts appropriately to be added to the compadd command line. -local stat f elt what +local stat f elt what dir local -a stylevals integer ok @@ -48,14 +48,17 @@ zmodload -i zsh/stat 2>/dev/null || return 1 -for f in ${(P)1}; do - if [[ ! -e "${2:+$2/}$f" ]]; then - listfiles+=("${2:+$2/}$f") +dir=${2:+$2/} +dir=${(Q)dir} + +for f in ${(PQ)1}; do + if [[ ! -e "$dir$f" ]]; then + listfiles+=("$dir$f") continue fi # Borrowed from Functions/Example/zls - stat -s -H stat -F "%b %e %H:%M" - "${2:+$2/}$f" >/dev/null 2>&1 + stat -s -H stat -F "%b %e %H:%M" - "$dir$f" >/dev/null 2>&1 listfiles+=("$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} \ ${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[mtime] $f") -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/