summaryrefslogtreecommitdiff
path: root/alot/commands.py
diff options
context:
space:
mode:
authorpazz <patricktotzke@gmail.com>2011-07-16 21:00:53 +0100
committerpazz <patricktotzke@gmail.com>2011-07-16 21:00:53 +0100
commitd7a7b336b2067f36e2881aa797db653584669b7a (patch)
treec4e41e6d6d2540ad876a0e85dbe37a0e05401f83 /alot/commands.py
parent7ba41d110e849c3fd363cb5ef02542cfa48ceec6 (diff)
fix toggletag command
Diffstat (limited to 'alot/commands.py')
-rw-r--r--alot/commands.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/alot/commands.py b/alot/commands.py
index a78c2579..e6d0c6e3 100644
--- a/alot/commands.py
+++ b/alot/commands.py
@@ -293,13 +293,15 @@ class FlushCommand(Command):
class ToggleThreadTagCommand(Command):
"""
"""
- def __init__(self, thread, tag, **kwargs):
- assert thread
+ def __init__(self, tag, thread=None, **kwargs):
+ assert tag
self.thread = thread
self.tag = tag
Command.__init__(self, **kwargs)
def apply(self, ui):
+ cb = ui.current_buffer
+ self.thread = cb.get_selected_thread()
try:
if self.tag in self.thread.get_tags():
self.thread.remove_tags([self.tag])
@@ -314,7 +316,6 @@ class ToggleThreadTagCommand(Command):
# update current buffer
# TODO: what if changes not yet flushed?
- cb = ui.current_buffer
if isinstance(cb, buffer.SearchBuffer):
# refresh selected threadline
threadwidget = cb.get_selected_threadline()