summaryrefslogtreecommitdiff
path: root/alot/commands
diff options
context:
space:
mode:
Diffstat (limited to 'alot/commands')
-rw-r--r--alot/commands/search.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/alot/commands/search.py b/alot/commands/search.py
index f3dc1831..db718807 100644
--- a/alot/commands/search.py
+++ b/alot/commands/search.py
@@ -210,6 +210,17 @@ class TagCommand(Command):
ui.dbman.tag(testquery, tags, remove_rest=True)
elif self.action == 'remove':
ui.dbman.untag(testquery, tags)
+ elif self.action == 'toggle':
+ if not self.allm:
+ to_remove = []
+ to_add = []
+ for t in tags:
+ if t in thread.get_tags():
+ to_remove.append(t)
+ else:
+ to_add.append(t)
+ thread.remove_tags(to_remove)
+ thread.add_tags(to_add, afterwards=refresh)
except DatabaseROError:
ui.notify('index in read-only mode', priority='error')
return