Index: lib/sup/modes/thread-index-mode.rb =================================================================== --- lib/sup/modes/thread-index-mode.rb (revision 673) +++ lib/sup/modes/thread-index-mode.rb (working copy) @@ -8,6 +8,14 @@ MIN_FROM_WIDTH = 15 LOAD_MORE_THREAD_NUM = 20 + + HookManager.register "index-mode-widget", < t } + @size_width = (@widgets.map { |w| (w != nil ? w.length : 0) }).max + if @size_width == 0 @size_width = (@threads.max_of { |t| t.size } || 0).num_digits + end + regen_text end @@ -467,12 +481,12 @@ def update_text_for_line l return unless l # not sure why this happens, but it does, occasionally - @text[l] = text_for_thread @threads[l] + @text[l] = text_for_thread @threads[l], @widgets[l] buffer.mark_dirty if buffer end def regen_text - @text = @threads.map_with_index { |t, i| text_for_thread t } + @text = @threads.map_with_index { |t, i| text_for_thread t, @widgets[i] } @lines = @threads.map_with_index { |t, i| [t, i] }.to_h buffer.mark_dirty if buffer end @@ -500,7 +514,7 @@ authors.compact.uniq.map { |a| [a, new[a]] } end - def text_for_thread t + def text_for_thread t, widget date = t.date.to_nice_s new = t.has_label?(:unread) @@ -550,6 +564,8 @@ snippet = t.snippet + (t.snippet.empty? ? "" : "...") + widget ||= (t.size == 1 ? " " * (@size_width + 2) : sprintf("(%#{ @size_width}d)", t.size)) + [ [:tagged_color, @tags.tagged?(t) ? ">" : " "], [:none, sprintf("%#{@date_width}s", date)], @@ -557,7 +573,7 @@ ] + from + [ - [subj_color, t.size == 1 ? " " * (@size_width + 2) : sprintf("(%#{@size_width}d)", t.size)], + [subj_color, sprintf("%#{@size_width}s", widget)], [:to_me_color, dp ? " >" : (p ? ' +' : " ")], [subj_color, t.subj + (t.subj.empty? ? "" : " ")], ] +