From: William Morgan Date: Sun, 13 Jan 2008 05:44:59 +0000 (-0800) Subject: make thread-view-mode 'n' and 'p' work with unreceived messages X-Git-Url: https://git.notmuchmail.org/git?a=commitdiff_plain;h=e3e6a5dd15d26a419442970baef647a348d24e48;p=sup 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'. --- 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