sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a828cc9542555d1c6fba0b3ade3b4a9ae16681dc
parent 0fdf24ead3975a91254ef0941519de9fefb0aae1
Author: Christopher Warrington <chrisw@rice.edu>
Date:   Mon,  3 Mar 2008 02:00:33 -0600

fixed off-by-one error in imap.rb and maildir.rb

The end_offset reported by imap and maildir sources was incorrect if there was
only one message in the source. Since end_offset is exclusive, we must add one to
the last known id to get include all valid message ids in the range.

Diffstat:
M lib/sup/imap.rb | 2 +-
M lib/sup/maildir.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
@@ -176,7 +176,7 @@ class IMAP < Source
 
   def end_offset
     unsynchronized_scan_mailbox
-    @ids.last
+    @ids.last + 1
   end
   synchronized :end_offset
 
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
@@ -123,7 +123,7 @@ class Maildir < Source
 
   def end_offset
     scan_mailbox :rescan => true
-    @ids.last
+    @ids.last + 1
   end
 
   def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end