k.add :edit_as_new, "Edit message as new", 'D'
k.add :save_to_disk, "Save message/attachment to disk", 's'
k.add :search, "Search for messages from particular people", 'S'
+ k.add :archive_and_kill, "Archive thread and kill buffer", 'A'
end
## there are a couple important instance variables we hold to lay
## TODO: don't recalculate EVERYTHING just to add a stupid little
## star to the display
update
- UpdateManager.relay :starred, m
+ UpdateManager.relay self, :starred, m
end
def toggle_expanded
end
end
- ## kinda slow for large threads. TODO: fasterify
def cleanup
- BufferManager.say "Marking messages as read..." do
- @thread.each do |m, d, p|
- if m && m.has_label?(:unread)
- m.remove_label :unread
- UpdateManager.relay :read, m
- end
- end
- end
+ @thread.remove_label :unread
+ UpdateManager.relay self, :read, @thread
@layout = @text = nil
end
+ def archive_and_kill
+ @thread.remove_label :inbox
+ UpdateManager.relay self, :archived, @thread
+ BufferManager.kill_buffer_safely buffer
+ end
+
private
def initial_state_for m
@text += chunk_to_lines m, nil, @text.length, depth, parent
next
end
- l = @layout[m]
+ l = @layout[m] or next # TODO: figure out why this is nil sometimes
## build the patina
text = chunk_to_lines m, l.state, @text.length, depth, parent, @layout[m].color