From e3e6a5dd15d26a419442970baef647a348d24e48 Mon Sep 17 00:00:00 2001 From: William Morgan Date: Sat, 12 Jan 2008 21:44:59 -0800 Subject: [PATCH] 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'. --- 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 index 9894aba..4f31338 100644 --- 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 -- 2.45.2