Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: sgoldman@tower-research.com (Steve Goldman)
Subject: [sup-talk] [PATCH] show matching aliases before email addresses in auto complete
Date: Sun, 23 Nov 2008 14:39:10 -0500	[thread overview]
Message-ID: <1227469112-sup-9061@sgoldmanlinux.tower-research.com> (raw)

---
 lib/sup/buffer.rb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index ebc3587..e56fbf7 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -433,7 +433,7 @@ EOS
       prefix, target = partial.split_on_commas_with_remainder
       target ||= prefix.pop || ""
       prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
-      completions.select { |x| x =~ /^#{Regexp::escape target}/i }.map { |x| [prefix + x, x] }
+      completions.select { |x| x =~ /^#{Regexp::escape target}/i }.sort_by { |c| [ContactManager.contact_for(c) ? 0 : 1, c] }.map { |x| [prefix + x, x] }
     end
   end
 
@@ -501,7 +501,7 @@ EOS
     recent = Index.load_contacts(AccountManager.user_emails, :num => 10).map { |c| [c.full_address, c.email] }
     contacts = ContactManager.contacts.map { |c| [ContactManager.alias_for(c), c.full_address, c.email] }
 
-    completions = (recent + contacts).flatten.uniq.sort
+    completions = (recent + contacts).flatten.uniq
     completions += HookManager.run("extra-contact-addresses") || []
     answer = BufferManager.ask_many_emails_with_completions domain, question, completions, default
 
-- 
1.5.6.4
-- 

Steve Goldman
sgoldman at tower-research.com

T: 212.219.6014
F: 212.219.6007

Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013


             reply	other threads:[~2008-11-23 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-23 19:39 Steve Goldman [this message]
2008-11-27  0:29 ` William Morgan
  -- strict thread matches above, loose matches on Subject: below --
2008-11-07 21:05 Steve Goldman
2008-11-10  5:11 ` William Morgan
2008-11-10  5:14   ` William Morgan
2008-11-10 14:55     ` Steve Goldman

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=1227469112-sup-9061@sgoldmanlinux.tower-research.com \
    --to=sgoldman@tower-research.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox