sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit e3e6a5dd15d26a419442970baef647a348d24e48
parent 89153e06366ce062d13a8771483d2bc289515832
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sat, 12 Jan 2008 21:44:59 -0800

make thread-view-mode 'n' and 'p' work with unreceived messages

Without this patch, if the cursor is on an unreceived message line,
it doesn't move upon hitting 'n' or 'p'.

Diffstat:
M lib/sup/modes/thread-view-mode.rb | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -285,7 +285,8 @@ EOS
 
   def jump_to_next_open
     return continue_search_in_buffer if in_search? # hack: allow 'n' to apply to both operations
-    m = @message_lines[curpos] or return
+    m = (curpos ... @message_lines.length).argfind { |i| @message_lines[i] }
+    return unless m
     while nextm = @layout[m].next
       break if @layout[nextm].state != :closed
       m = nextm
@@ -294,7 +295,8 @@ EOS
   end
 
   def jump_to_prev_open
-    m = @message_lines[curpos] or return
+    m = (0 .. curpos).to_a.reverse.argfind { |i| @message_lines[i] } # bah, .to_a
+    return unless m
     ## jump to the top of the current message if we're in the body;
     ## otherwise, to the previous message