]> git.cworth.org Git - sup/commitdiff
make thread-view-mode 'n' and 'p' work with unreceived messages
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 13 Jan 2008 05:44:59 +0000 (21:44 -0800)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 13 Jan 2008 05:44:59 +0000 (21:44 -0800)
Without this patch, if the cursor is on an unreceived message line,
it doesn't move upon hitting 'n' or 'p'.

lib/sup/modes/thread-view-mode.rb

index 9894aba4dc186169c073a586a56e2bf4b6e7b1f7..4f313386d5afe0cd077fc1464e275fcef61a3b8b 100644 (file)
@@ -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