From 1214dceab392127327a23b924bd78880dd49b077 Mon Sep 17 00:00:00 2001 From: ty221 Date: Fri, 16 Jan 2015 21:13:44 +0100 Subject: [PATCH 1/3] Asking for confirmation, when trying to open more than one tagged thread at once --- lib/sup/modes/thread_index_mode.rb | 9 ++++++++- lib/sup/tagger.rb | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/sup/modes/thread_index_mode.rb b/lib/sup/modes/thread_index_mode.rb index 71d3fed64..47b4fcc6e 100644 --- a/lib/sup/modes/thread_index_mode.rb +++ b/lib/sup/modes/thread_index_mode.rb @@ -135,7 +135,14 @@ def select t=nil, when_done=nil end def multi_select threads - threads.each { |t| select t } + tagged_no = @tags.number_of_tagged + if tagged_no > 1 + if BufferManager.ask_yes_or_no "Are you sure, you want to open #{tagged_no} threads (y/n)?" + threads.each { |t| select t } + end + else + threads.each { |t| select t } + end end ## these two methods are called by thread-view-modes when the user diff --git a/lib/sup/tagger.rb b/lib/sup/tagger.rb index d02b04513..a027a72f2 100644 --- a/lib/sup/tagger.rb +++ b/lib/sup/tagger.rb @@ -16,7 +16,8 @@ def tag o; @tagged[o] = true; end def untag o; @tagged[o] = false; end def drop_all_tags; @tagged.clear; end def drop_tag_for o; @tagged.delete o; end - + def number_of_tagged; @tagged.select_by_value.size; end + def apply_to_tagged action=nil targets = @tagged.select_by_value num_tagged = targets.size From 8ae475f8f8832667e0f89e565ad4b7dd26185c11 Mon Sep 17 00:00:00 2001 From: ty221 Date: Sat, 17 Jan 2015 23:29:48 +0100 Subject: [PATCH 2/3] Couting how many messages will be opened, before multi_select --- lib/sup/modes/thread_index_mode.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sup/modes/thread_index_mode.rb b/lib/sup/modes/thread_index_mode.rb index 47b4fcc6e..ae767acaa 100644 --- a/lib/sup/modes/thread_index_mode.rb +++ b/lib/sup/modes/thread_index_mode.rb @@ -137,7 +137,9 @@ def select t=nil, when_done=nil def multi_select threads tagged_no = @tags.number_of_tagged if tagged_no > 1 - if BufferManager.ask_yes_or_no "Are you sure, you want to open #{tagged_no} threads (y/n)?" + total_msg_no = 0 + threads.each { |t| total_msg_no += t.size } + if BufferManager.ask_yes_or_no "Are you sure, you want to open #{total_msg_no} messages (y/n)?" threads.each { |t| select t } end else From e58216f326537abf282c311d85adad7c563bdcb1 Mon Sep 17 00:00:00 2001 From: ty221 Date: Sun, 18 Jan 2015 08:58:35 +0100 Subject: [PATCH 3/3] Added info about quantity of threads before multi_select --- lib/sup/modes/thread_index_mode.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sup/modes/thread_index_mode.rb b/lib/sup/modes/thread_index_mode.rb index ae767acaa..3cd116dcd 100644 --- a/lib/sup/modes/thread_index_mode.rb +++ b/lib/sup/modes/thread_index_mode.rb @@ -139,7 +139,7 @@ def multi_select threads if tagged_no > 1 total_msg_no = 0 threads.each { |t| total_msg_no += t.size } - if BufferManager.ask_yes_or_no "Are you sure, you want to open #{total_msg_no} messages (y/n)?" + if BufferManager.ask_yes_or_no "Are you sure, you want to open #{tagged_no} threads with #{total_msg_no} messages (y/n)?" threads.each { |t| select t } end else