summaryrefslogtreecommitdiff
path: root/alot/commands
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-02-25 18:30:31 +0100
committerAnton Khirnov <anton@khirnov.net>2020-02-25 18:30:31 +0100
commit8422972845bed9253d7a5dad2b901fa4247708cd (patch)
treece3341e823d39f752a1ee31c55e480383b0d9894 /alot/commands
parentc3bd46cd204466038401365ef229c747b2c4242c (diff)
thread buffer: make attachments work again
Diffstat (limited to 'alot/commands')
-rw-r--r--alot/commands/thread.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 26045ca8..87e6b4a3 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -832,9 +832,9 @@ class SaveAttachmentCommand(Command):
else:
raise CommandCanceled()
else: # save focussed attachment
- focus = ui.get_deep_focus()
- if hasattr(focus, 'attachment'):
- filename = focus.attachment.get_filename()
+ attachment = ui.current_buffer.get_selected_attachment()
+ if attachment is not None:
+ filename = attachment.get_filename()
if not self.path:
msg = 'save attachment (%s) to ' % filename
initialtext = os.path.join(savedir, filename)
@@ -843,7 +843,7 @@ class SaveAttachmentCommand(Command):
text=initialtext)
if self.path:
try:
- dest = focus.attachment.save(self.path)
+ dest = attachment.save(self.path)
ui.notify('saved attachment as: %s' % dest)
except (IOError, OSError) as e:
ui.notify(str(e), priority='error')
@@ -971,10 +971,10 @@ class ThreadSelectCommand(Command):
- if it is a message summary, toggle visibility of the message;
- if it is an attachment line, open the attachment"""
async def apply(self, ui):
- focus = ui.get_deep_focus()
- if hasattr(focus, 'attachment'):
+ attachment = ui.current_buffer.get_selected_attachment()
+ if attachment is not None:
logging.info('open attachment')
- await ui.apply_command(OpenAttachmentCommand(focus.attachment))
+ await ui.apply_command(OpenAttachmentCommand(attachment))
else:
await ui.apply_command(ChangeDisplaymodeCommand(visible='toggle'))