From: Clint Adams <schizo@debian.org>
To: martin f krafft <madduck@debian.org>, 527301@bugs.debian.org
Cc: zsh-workers@sunsite.dk
Subject: Re: Bug#527301: _xmms2 jump/_values: suboptimal presentation/sorting
Date: Wed, 6 May 2009 17:26:31 +0000 [thread overview]
Message-ID: <20090506172631.GA2668@scru.org> (raw)
In-Reply-To: <20090506162216.GA24031@piper.oerlikon.madduck.net>
On Wed, May 06, 2009 at 06:22:16PM +0200, martin f krafft wrote:
> `xmms2 jump` completion uses
>
> _values -s ' ' 'playlist items' ${(On)playlistitems}
>
> where $playlistitems is an array with items e.g.
>
> 1[foo]
> 2[bar]
> ...
> 12[baz]
> 13[foo]
>
> Unfortunately, it seems as if _values does something weird:
> Even though ${(On)...} yields a reverse-numerically sorted list of
> those items, the output seems not numerically sorted.
>
> In addition, the way _values merges keys with the same value (1 and
> 13 in the above) is suboptimal for the use case.
>
> This list:
>
> [0/193] Deep Purple - Highway Star (06:43)
> [1/194] Deep Purple - Child in Time (12:17)
> [2/195] Deep Purple - Smoke on the Water (07:36)
> [3/196] Deep Purple - The Mule (09:28)
> [4/197] Deep Purple - Strange Kind of Woman (09:52)
> [5/198] Deep Purple - Lazy (10:27)
> [6/199] Deep Purple - Space Truckin' (19:54)
> [7/200] Deep Purple - Black Night (06:18)
> [8/201] Deep Purple - Speed King (07:24)
> [9/202] Deep Purple - Lucille (08:03)
> [10/203] Deep Purple - Highway Star (06:41)
> [11/204] Deep Purple - Black Night (05:48)
> [12/205] Deep Purple - A Twist in the Tail (04:23)
> [13/206] Deep Purple - Perfect Strangers (06:52)
> [14/207] Deep Purple - Anyone's Daugher (03:52)
> [15/208] Deep Purple - Child in Time (10:42)
> [16/209] Deep Purple - Anya (12:08)
> [17/210] Deep Purple - Speed King (07:33)
> [18/211] Deep Purple - Smoke on the Water (10:09)
>
> Yields this completion output:
>
> playlist items
> 10 -- Deep Purple - Highway Star
> 11 7 -- Deep Purple - Black Night
> 12 -- Deep Purple - A Twist in the Tail
> 13 -- Deep Purple - Perfect Strangers
> 14 -- Deep Purple - Anyone's Daugher
> 15 1 -- Deep Purple - Child in Time
> 16 -- Deep Purple - Anya
> 17 8 -- Deep Purple - Speed King
> 18 2 -- Deep Purple - Smoke on the Water
> 3 -- Deep Purple - The Mule
> 4 -- Deep Purple - Strange Kind of Woman
> 5 -- Deep Purple - Lazy
> 6 -- Deep Purple - Space Truckin'
> 9 -- Deep Purple - Lucille
>
> I am sure you'll agree that that's not really useful. It would be
> better to have proper numeric sorting and disable the merging.
You can try this for yourself:
zstyle :completion::complete:xmms2:\*:values list-grouped false
zstyle :completion::complete:xmms2:\*:values sort false
I have no opinion on how the default behavior should be handled.
Also, setting IFS to "oldIFS" doesn't seem useful, so here's some cleanup.
Index: Completion/Unix/Command/_xmms2
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_xmms2,v
retrieving revision 1.2
diff -u -r1.2 _xmms2
--- Completion/Unix/Command/_xmms2 5 May 2009 08:47:55 -0000 1.2
+++ Completion/Unix/Command/_xmms2 6 May 2009 17:22:18 -0000
@@ -55,14 +55,11 @@
}
_xmms2_jump() {
- oldIFS=$IFS
- IFS=$'\n'
- songlist=($(xmms2 list))
- IFS=oldIFS
- playlistitems=""
+ songlist=(${"$(xmms2 list)"})
+ playlistitems=()
for song ($songlist); do
if [[ $song = (#b)' '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then
- playlistitems=($playlistitems "$match[1][$match[3]]")
+ playlistitems+=("$match[1][$match[3]]")
fi
done
next parent reply other threads:[~2009-05-06 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090506162216.GA24031@piper.oerlikon.madduck.net>
2009-05-06 17:26 ` Clint Adams [this message]
2009-05-06 19:36 ` martin f krafft
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=20090506172631.GA2668@scru.org \
--to=schizo@debian.org \
--cc=527301@bugs.debian.org \
--cc=madduck@debian.org \
--cc=zsh-workers@sunsite.dk \
/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).