From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.224.197 with SMTP id ip5cs149551icb; Sun, 20 Feb 2011 17:42:22 -0800 (PST) Received: by 10.52.167.42 with SMTP id zl10mr1004403vdb.299.1298252541949; Sun, 20 Feb 2011 17:42:21 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id r11si6843045vch.73.2011.02.20.17.42.21; Sun, 20 Feb 2011 17:42:21 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6C4E63C8039; Sun, 20 Feb 2011 20:42:21 -0500 (EST) Received: from mail-ww0-f54.google.com (mail-ww0-f54.google.com [74.125.82.54]) by rubyforge.org (Postfix) with ESMTP id 2637E185834E for ; Sun, 20 Feb 2011 20:22:44 -0500 (EST) Received: by wwb31 with SMTP id 31so5685225wwb.23 for ; Sun, 20 Feb 2011 17:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:cc:subject:from:to:in-reply-to :references:date:message-id:user-agent:content-transfer-encoding; bh=p+DhIx+2nbZS/bseG5Y2pE7tN5ge17BcwmRBc05nRMQ=; b=diIhf7xYk2D26GVwHAyyG0yE39vV+dKkLxnxK2eouCxUHZ2Amore7+g9qlhKZvjdP7 18gRWNkLNCh63Urbyh3YtSbNGxY0Nl++OWMegMWGbgLHKIg53rerNjyqo0Woe0cyYzoO mY3MRKTCjED2+oMsiheNYY03+Rs6BqBThqf/M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:cc:subject:from:to:in-reply-to:references:date :message-id:user-agent:content-transfer-encoding; b=JwYyGZS3NQY2us/fKWZAaR1HueTdRsrOlFZR1dwguJ+KEsuYG7mILCZqPpLG6uv5zI gy1wNMvnrqrkZ4gUi7py4y2K/P2DPMBF6hu3+BwPfpmqeLhirq+x8ExGax478t/W/1jA zEpdMUgJ2DTYySPcz/xiswKHnynn9zllohTUU= Received: by 10.216.161.74 with SMTP id v52mr614734wek.109.1298251364313; Sun, 20 Feb 2011 17:22:44 -0800 (PST) Received: from localhost (cpc12-cmbg15-2-0-cust81.5-4.cable.virginmedia.com [86.30.247.82]) by mx.google.com with ESMTPS id n78sm1837445weq.27.2011.02.20.17.22.42 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 20 Feb 2011 17:22:43 -0800 (PST) From: Hamish To: Philippe LeCavalier In-reply-to: <1297863023-sup-4209@plc.intranet.plecavalier.com> References: <1297784079-sup-7440@plc.intranet.plecavalier.com> <1297847031-sup-6835@tilus.net> <1297863023-sup-4209@plc.intranet.plecavalier.com> Date: Mon, 21 Feb 2011 01:22:41 +0000 Message-Id: <1298250926-sup-5020@whisper> User-Agent: Sup/git Cc: sup-devel@rubyforge.org Subject: Re: [sup-devel] [sup-talk] Label Display; Sorting Alphabetically X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org Excerpts from Philippe LeCavalier's message of Wed Feb 16 13:33:32 +0000 2011: > > Philippe LeCavalier, 2011-02-15 17:37: > > > Hi All. Just wondering if there has ever been any consideration to > > > sorting labels alphabetically. I'm assuming the way sup displays the > > > labels is purely esthetic's? > > > > I assume you are talking about thread index mode. > No. Any mode really. Even in search mode they're random. No longer! I've published a branch called order_labels that will fix this, both in the various thread index modes, and when editing the labels for a message. Diffs at the end of the email for your viewing pleasure ... I'll merge this into next when I'm a bit more awake - been up a bit long ... Hamish Downer commit 1ae7c0a1e5b20681ea6ecb9a6bf15fffa5f4c0e3 Author: Hamish Downer Date: Sun Feb 20 22:57:47 2011 +0000 Order labels alphabetically in thread index mode diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 11548c7..36d6db3 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -893,7 +893,7 @@ protected [:to_me_color, t.labels.member?(:attachment) ? "@" : " "], [:to_me_color, dp ? ">" : (p ? '+' : " ")], ] + - (t.labels - @hidden_labels).map { |label| [:label_color, "#{label} "] } + + (t.labels - @hidden_labels).sort_by {|x| x.to_s}.map { |label| [:label_color, "#{label} "] } + [ [subj_color, t.subj + (t.subj.empty? ? "" : " ")], [:snippet_color, t.snippet], commit 490e57254c5ee493e8acf4b8358b54e7eb3ab698 Author: Hamish Downer Date: Sun Feb 20 23:22:05 2011 +0000 When editing labels, they are presented in alphabetical order diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 36d6db3..613aa61 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -542,7 +542,7 @@ EOS keepl, modifyl = thread.labels.partition { |t| speciall.member? t } - user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl, @hidden_labels + user_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", modifyl.sort_by {|x| x.to_s}, @hidden_labels return unless user_labels thread.labels = Set.new(keepl) + user_labels diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 59705bc..e69de57 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -282,7 +282,7 @@ EOS def edit_labels old_labels = @thread.labels reserved_labels = old_labels.select { |l| LabelManager::RESERVED_LABELS.include? l } - new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels + new_labels = BufferManager.ask_for_labels :label, "Labels for thread: ", @thread.labels.sort_by {|x| x.to_s} return unless new_labels @thread.labels = Set.new(reserved_labels) + new_labels _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel