From: wmorgan Date: Fri, 5 Jan 2007 16:51:46 +0000 (+0000) Subject: made the contact list load enough entries to fill the whole buffer, rather X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=284ab506c479645477af9deb9f60186747aa4dfd;p=sup made the contact list load enough entries to fill the whole buffer, rather than just 10. git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@186 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/bin/sup b/bin/sup index 28334b6..3b4a34c 100644 --- a/bin/sup +++ b/bin/sup @@ -129,7 +129,8 @@ begin when :list_buffers bm.spawn_unless_exists("Buffer List") { BufferListMode.new } when :list_contacts - bm.spawn_unless_exists("Contact List") { ContactListMode.new } + b = bm.spawn_unless_exists("Contact List") { ContactListMode.new } + b.mode.load_more b.content_height when :search text = bm.ask :search, "query: " next unless text && text !~ /^\s*$/ @@ -162,7 +163,9 @@ begin when 1 m = nil Index.each_id_by_date(:label => :draft) { |mid, builder| m = builder.call } - BufferManager.spawn "Edit message", ResumeMode.new(m) + r = ResumeMode.new(m) + BufferManager.spawn "Edit message", r + r.edit else b = BufferManager.spawn_unless_exists(:draft) do mode = LabelSearchResultsMode.new [:draft] diff --git a/lib/sup/modes/contact-list-mode.rb b/lib/sup/modes/contact-list-mode.rb index 1a51d12..fe10a2c 100644 --- a/lib/sup/modes/contact-list-mode.rb +++ b/lib/sup/modes/contact-list-mode.rb @@ -15,7 +15,7 @@ class ContactListMode < LineCursorMode def initialize mode = :regular @mode = mode @tags = Tagger.new self - reload + @num = 0 super() end @@ -37,10 +37,10 @@ class ContactListMode < LineCursorMode def apply_to_tagged; @tags.apply_to_tagged; end def load; regen_text; end - def load_more - @num += LOAD_MORE_CONTACTS_NUM + def load_more num=LOAD_MORE_CONTACTS_NUM + @num += num regen_text - BufferManager.flash "Loaded #{LOAD_MORE_CONTACTS_NUM} more contacts." + BufferManager.flash "Added #{num} contacts." end def multi_select people @@ -70,7 +70,6 @@ class ContactListMode < LineCursorMode def reload @tags.drop_all_tags - @num = LOAD_MORE_CONTACTS_NUM load end