Skip to content

Commit

Permalink
Show currently displayed mime part in status bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryneeverett authored and pazz committed May 6, 2020
1 parent c2ed49c commit 98b1040
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions alot/buffers/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def get_info(self):
info['message_count'] = self.message_count
info['thread_tags'] = self.translated_tags_str()
info['intersection_tags'] = self.translated_tags_str(intersection=True)
info['mimetype'] = (
self.get_selected_message().mime_part.get_content_type())
return info

def get_selected_thread(self):
Expand Down
5 changes: 5 additions & 0 deletions alot/commands/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ def matches(msgt):
elif self.mimepart is True:
mimepart = ui.get_deep_focus().mimepart
mt.set_mimepart(mimepart)
ui.update()
if self.mimetree == 'toggle':
tbuffer.focus_selected_message()
mimetree = not mt.display_mimetree \
Expand Down Expand Up @@ -1015,6 +1016,7 @@ class MoveFocusCommand(MoveCommand):

def apply(self, ui):
logging.debug(self.movement)
original_focus = ui.get_deep_focus()
tbuffer = ui.current_buffer
if self.movement == 'parent':
tbuffer.focus_parent()
Expand Down Expand Up @@ -1045,6 +1047,9 @@ def apply(self, ui):
# TODO add 'next matching' if threadbuffer stores the original query
# TODO: add next by date..

if original_focus != ui.get_deep_focus():
ui.update()


@registerCommand(MODE, 'select')
class ThreadSelectCommand(Command):
Expand Down
3 changes: 2 additions & 1 deletion alot/defaults/alot.rc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ search_statusbar = mixed_list(string, string, default=list('[{buffer_no}: search
# * `{message_count}`: number of contained messages
# * `{thread_tags}`: displays all tags present in the current thread.
# * `{intersection_tags}`: displays tags common to all messages in the current thread.
# * `{mimetype}`: content type of the mime part displayed in the focused message.

thread_statusbar = mixed_list(string, string, default=list('[{buffer_no}: thread] {subject}','{input_queue} total messages: {total_messages}'))
thread_statusbar = mixed_list(string, string, default=list('[{buffer_no}: thread] {subject}','[{mimetype}] {input_queue} total messages: {total_messages}'))

# Format of the status-bar in taglist mode.
# This is a pair of strings to be left and right aligned in the status-bar.
Expand Down
3 changes: 2 additions & 1 deletion docs/source/configuration/alotrc_table
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,10 @@
* `{message_count}`: number of contained messages
* `{thread_tags}`: displays all tags present in the current thread.
* `{intersection_tags}`: displays tags common to all messages in the current thread.
* `{mimetype}`: content type of the mime part displayed in the focused message.

:type: mixed_list
:default: [{buffer_no}: thread] {subject}, {input_queue} total messages: {total_messages}
:default: [{buffer_no}: thread] {subject}, [{mimetype}] {input_queue} total messages: {total_messages}


.. _thread-subject:
Expand Down

0 comments on commit 98b1040

Please sign in to comment.