sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 284ab506c479645477af9deb9f60186747aa4dfd
parent 9997a5996539eb15990b51a660a9d1c3699bc3c4
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Fri,  5 Jan 2007 16:51:46 +0000

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

Diffstat:
M bin/sup | 7 +++++--
M lib/sup/modes/contact-list-mode.rb | 9 ++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git 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
@@ -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