summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorLucas Hoffmann <lucc@users.noreply.github.com>2017-08-07 01:37:36 +0200
committerGitHub <noreply@github.com>2017-08-07 01:37:36 +0200
commit4f78529875c2687e58586c43512a71787f72fccb (patch)
tree3fae403942e485eb3d4a91c69e29d98421d45121 /alot
parentb9b17016e717f8b2357c1312a169ee6b8946956e (diff)
parent4876cba1ab3abd42f0ef871090b763e9fba05ba5 (diff)
Merge pull request #988 from lucc/move-next-matching
Add `move next matching` command in thread buffer
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py2
-rw-r--r--alot/commands/thread.py12
-rw-r--r--alot/completion.py12
-rw-r--r--alot/db/message.py2
4 files changed, 20 insertions, 8 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 7c590802..79b7e5f6 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -927,7 +927,7 @@ class ComposeCommand(Command):
arguments=[
(['movement'],
{'nargs': argparse.REMAINDER,
- 'help': 'up, down, [half]page up, [half]page down, first'})])
+ 'help': 'up, down, [half]page up, [half]page down, first, last'})])
class MoveCommand(Command):
"""move in widget"""
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 4c5ce5ef..acbb4e28 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -996,7 +996,11 @@ class OpenAttachmentCommand(Command):
arguments=[
(['movement'],
{'nargs': argparse.REMAINDER,
- 'help': 'up, down, page up, page down, first, last'})])
+ 'help': '''up, down, [half]page up, [half]page down, first, last, \
+ parent, first reply, last reply, \
+ next sibling, previous sibling, next, previous, \
+ next unfolded, previous unfolded, \
+ next NOTMUCH_QUERY, previous NOTMUCH_QUERY'''})])
class MoveFocusCommand(MoveCommand):
def apply(self, ui):
@@ -1020,6 +1024,12 @@ class MoveFocusCommand(MoveCommand):
tbuffer.focus_next_unfolded()
elif self.movement == 'previous unfolded':
tbuffer.focus_prev_unfolded()
+ elif self.movement.startswith('next '):
+ query = self.movement[5:].strip()
+ tbuffer.focus_next_matching(query)
+ elif self.movement.startswith('previous '):
+ query = self.movement[9:].strip()
+ tbuffer.focus_prev_matching(query)
else:
MoveCommand.apply(self, ui)
# TODO add 'next matching' if threadbuffer stores the original query
diff --git a/alot/completion.py b/alot/completion.py
index 5d0b132e..88eee312 100644
--- a/alot/completion.py
+++ b/alot/completion.py
@@ -482,12 +482,14 @@ class CommandCompleter(Completer):
separator=',')
res = localcomp.complete(params, localpos)
elif cmd == 'move':
- directions = ['up', 'down', 'page up', 'page down']
+ directions = ['up', 'down', 'page up', 'page down',
+ 'halfpage up', 'halfpage down', 'first',
+ 'last']
if self.mode == 'thread':
- directions += ['first', 'last', 'next', 'previous',
- 'last reply', 'first reply', 'parent',
- 'next unfolded', 'previous unfolded',
- 'next sibling', 'previous sibling']
+ directions += ['parent', 'first reply', 'last reply',
+ 'next sibling', 'previous sibling',
+ 'next', 'previous', 'next unfolded',
+ 'previous unfolded']
localcompleter = StringlistCompleter(directions)
res = localcompleter.complete(params, localpos)
diff --git a/alot/db/message.py b/alot/db/message.py
index 747321be..5b0c19dc 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -254,5 +254,5 @@ class Message(object):
def matches(self, querystring):
"""tests if this messages is in the resultset for `querystring`"""
- searchfor = querystring + ' AND id:' + self._id
+ searchfor = '( {} ) AND id:{}'.format(querystring, self._id)
return self._dbman.count_messages(searchfor) > 0