summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/commandfactory.py15
-rw-r--r--alot/commands.py18
-rw-r--r--alot/settings.py2
3 files changed, 21 insertions, 14 deletions
diff --git a/alot/commandfactory.py b/alot/commandfactory.py
index fab357d4..6d4f40d1 100644
--- a/alot/commandfactory.py
+++ b/alot/commandfactory.py
@@ -38,7 +38,8 @@ COMMANDS = {
'edit': (commands.EditCommand, {}),
'commandprompt': (commands.CommandPromptCommand, {}),
'openthread': (commands.OpenThreadCommand, {}),
- 'refine': (commands.RefineSearchPromptCommand, {}),
+ 'refine': (commands.RefineCommand, {}),
+ 'refineprompt': (commands.RefinePromptCommand, {}),
'toggletag': (commands.ToggleThreadTagCommand, {'tag': 'inbox'}),
'bufferfocus': (commands.BufferFocusCommand, {}),
'closefocussed': (commands.BufferCloseCommand, {'focussed': True}),
@@ -95,7 +96,7 @@ globalcomands = [
]
ALLOWED_COMMANDS = {
- 'search': ['refine', 'toggletag', 'openthread', 'retag', 'retagprompt'] + globalcomands,
+ 'search': ['refine', 'refineprompt', 'toggletag', 'openthread', 'retag', 'retagprompt'] + globalcomands,
'envelope': ['send'] + globalcomands,
'bufferlist': ['bufferfocussed', 'closefocussed'] + globalcomands,
'taglist': globalcomands,
@@ -131,22 +132,22 @@ def interpret_commandline(cmdline, mode):
if not params: # commands that work without parameter
if cmd in ['exit', 'flush', 'pyshell', 'taglist', 'close',
'closefocussed', 'bnext', 'bprevious', 'retag',
- 'refresh', 'bufferlist', 'refine', 'openthread',
+ 'refresh', 'bufferlist', 'refineprompt', 'openthread',
'bufferfocus', 'retagprompt']:
return commandfactory(cmd)
else:
return None
else:
if cmd == 'search':
- return commandfactory(cmd, query=params[0])
+ return commandfactory(cmd, query=params)
elif cmd == 'refine':
- return commandfactory(cmd, query=params[0])
+ return commandfactory(cmd, query=params)
elif cmd == 'shellescape':
return commandfactory(cmd, commandstring=params)
elif cmd == 'toggletag':
- return commandfactory(cmd, tag=params[0])
+ return commandfactory(cmd, tag=params)
elif cmd == 'retag':
- return commandfactory(cmd, tagsstring=params[0])
+ return commandfactory(cmd, tagsstring=params)
elif cmd == 'edit':
filepath = params[0]
if os.path.isfile(filepath):
diff --git a/alot/commands.py b/alot/commands.py
index a030aa16..14eac822 100644
--- a/alot/commands.py
+++ b/alot/commands.py
@@ -402,7 +402,7 @@ class ComposeCommand(Command):
class RetagPromptCommand(Command):
- """prompt the user for labels, then tag thread"""
+ """start a commandprompt to retag selected threads' tags"""
def apply(self, ui):
thread = ui.current_buffer.get_selected_thread()
@@ -411,7 +411,7 @@ class RetagPromptCommand(Command):
class RetagCommand(Command):
- """prompt the user for labels, then tag thread"""
+ """tag selected thread"""
def __init__(self, tagsstring=u'', **kwargs):
self.tagsstring = tagsstring
@@ -437,7 +437,7 @@ class RetagCommand(Command):
threadwidget.rebuild() # rebuild and redraw the line
-class RefineSearchPromptCommand(Command):
+class RefineCommand(Command):
"""refine the query of the currently open searchbuffer"""
def __init__(self, query=None, **kwargs):
@@ -447,11 +447,17 @@ class RefineSearchPromptCommand(Command):
def apply(self, ui):
sbuffer = ui.current_buffer
oldquery = sbuffer.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()
+
+
+class RefinePromptCommand(Command):
+ """prompt to change current search buffers query"""
+
+ def apply(self, ui):
+ sbuffer = ui.current_buffer
+ oldquery = sbuffer.querystring
+ ui.commandprompt('refine ' + oldquery)
diff --git a/alot/settings.py b/alot/settings.py
index 436b8d8d..d592b469 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -323,7 +323,7 @@ MAPPING = {
'm': ('compose', ''),
},
'search': {
- '|': ('refine',''),
+ '|': ('refineprompt',''),
'enter': ('openthread', ''),
'l': ('retagprompt', ''),
'a': ('toggletag inbox', ''),