Commit 54d7b514ad589f4451fbb874a0bd2aa62fa9ac3b

LabelListMode: pass code block for the select_label action

This will help on two things:
- Reducing duplicate code that handles the selected label on 'L'
- Use the label list for other actions also (such as using
  inbox-subset-mode in the future)

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
bin/sup
(3 / 1)
  
249249 user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
250250 unless user_label.nil?
251251 if user_label.empty?
252 bm.spawn_unless_exists("Label list") { LabelListMode.new }
252 bm.spawn_unless_exists("Label list") do
253 LabelListMode.new { |l| LabelSearchResultsMode.spawn_nicely l }
254 end
253255 else
254256 LabelSearchResultsMode.spawn_nicely user_label
255257 end
  
88 k.add :toggle_show_unread_only, "Toggle between showing all labels and those with unread mail", 'u'
99 end
1010
11 def initialize
11 def initialize &p
1212 @labels = []
1313 @text = []
1414 @unread_only = false
15 @proc = p
1516 super
1617 regen_text
1718 end
8484 def select_label
8585 label, num_unread = @labels[curpos]
8686 return unless label
87 LabelSearchResultsMode.spawn_nicely label
87 @proc.call label
8888 end
8989end
9090