diff options
author | pazz <patricktotzke@gmail.com> | 2011-07-16 13:31:44 +0100 |
---|---|---|
committer | pazz <patricktotzke@gmail.com> | 2011-07-16 13:31:44 +0100 |
commit | 6aafb8c09261294902e8bbcacd5beda6a25c72cd (patch) | |
tree | 1a9db5c3b841b89cc84603470b77ed2f43d65b5f /alot/commands.py | |
parent | a0c52f811d033b2fb0c7680de378a8fd12090e46 (diff) |
refine command from commandline + tabcomp
Diffstat (limited to 'alot/commands.py')
-rw-r--r-- | alot/commands.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/alot/commands.py b/alot/commands.py index b7a839a4..4392c64b 100644 --- a/alot/commands.py +++ b/alot/commands.py @@ -420,15 +420,20 @@ class ThreadTagPromptCommand(Command): class RefineSearchPromptCommand(Command): - """refine the current search""" + """refine the query of the currently open searchbuffer""" + + def __init__(self, query=None, **kwargs): + self.querystring = query + Command.__init__(self, **kwargs) def apply(self, ui): sbuffer = ui.current_buffer oldquery = sbuffer.querystring - querystring = ui.prompt('refine search:', text=oldquery, - completer=completion.QueryCompleter(ui.dbman)) - if querystring not in [None, oldquery]: - sbuffer.querystring = querystring + if not self.querystring: + self.querystring = ui.prompt('refine search:', text=oldquery, + completer=completion.QueryCompleter(ui.dbman)) + if self.querystring not in [None, oldquery]: + sbuffer.querystring = self.querystring sbuffer = ui.current_buffer sbuffer.rebuild() ui.update() |