* [sup-devel] [PATCH] copy thread when spawning ThreadViewMode
@ 2010-01-22 4:25 Rich Lane
2010-01-25 16:21 ` Rich Lane
0 siblings, 1 reply; 2+ messages in thread
From: Rich Lane @ 2010-01-22 4:25 UTC (permalink / raw)
To: sup-devel
Currently ThreadIndexMode just passes a reference to the selected thread when
spawning a ThreadViewMode. This is a problem because as long as the original
ThreadIndexMode is alive that thread will be updated with new messages, but
ThreadViewMode will not display them. This can lead to the user unknowingly
archiving a thread containing unread messages.
---
lib/sup/modes/thread-index-mode.rb | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb
index a6bb2b9..ca5e1f3 100644
--- a/lib/sup/modes/thread-index-mode.rb
+++ b/lib/sup/modes/thread-index-mode.rb
@@ -94,6 +94,18 @@ EOS
load_threads :num => buffer.content_height
end
+ def copy_thread t
+ ts = ThreadSet.new nil
+ t.each_with_index do |(m, *o), i|
+ next unless m
+ yield i
+ m.load_from_source!
+ ts.add_message m
+ end
+ fail unless ts.threads.size == 1
+ ts.threads.first
+ end
+
## open up a thread view window
def select t=nil, when_done=nil
t ||= cursor_thread or return
@@ -102,10 +114,8 @@ EOS
num = t.size
message = "Loading #{num.pluralize 'message body'}..."
BufferManager.say(message) do |sid|
- t.each_with_index do |(m, *o), i|
- next unless m
+ t = copy_thread t do |i|
BufferManager.say "#{message} (#{i}/#{num})", sid if t.size > 1
- m.load_from_source!
end
end
mode = ThreadViewMode.new t, @hidden_labels, self
--
1.6.3.3
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-devel] [PATCH] copy thread when spawning ThreadViewMode
2010-01-22 4:25 [sup-devel] [PATCH] copy thread when spawning ThreadViewMode Rich Lane
@ 2010-01-25 16:21 ` Rich Lane
0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-01-25 16:21 UTC (permalink / raw)
To: sup-devel
This breaks ThreadIndexMode#launch_another_thread. I'll send a
new patch.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-25 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-22 4:25 [sup-devel] [PATCH] copy thread when spawning ThreadViewMode Rich Lane
2010-01-25 16:21 ` Rich Lane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox