commit ab807bc1c993adc16ce2c5dee0551fdb2d4eff67
parent c72b14b817e16ad7780ed3c16d0b6b210878aa1c
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Thu, 18 Jan 2007 01:50:45 +0000
bugfix: jump_to_first_open
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@263 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
@@ -61,7 +61,7 @@ class ThreadIndexMode < LineCursorMode
mode = ThreadViewMode.new t, @hidden_labels
BufferManager.spawn t.subj, mode
BufferManager.draw_screen
- mode.jump_to_next_open
+ mode.jump_to_first_open
BufferManager.draw_screen # lame TODO: make this unnecessary
## the first draw_screen is needed before topline and botline
## are set, and the second to show the cursor having moved
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -168,10 +168,19 @@ class ThreadViewMode < LineCursorMode
end
end
+ def jump_to_first_open
+ m = @message_lines[0] or return
+ if @layout[m].state != :closed
+ jump_to_message m
+ else
+ jump_to_next_open
+ end
+ end
+
def jump_to_next_open
m = @message_lines[curpos] or return
while nextm = @layout[m].next
- break if @layout[nextm].state == :open
+ break if @layout[nextm].state != :closed
m = nextm
end
jump_to_message nextm if nextm