Commit 8f69b6d1 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Negative values for the LimitFilter disables the filter.

The default value for this limit is -1 now. Any non-negative value
will be used for the LimitFilter.
parent 84421e39
...@@ -8,7 +8,7 @@ colors = 1 ...@@ -8,7 +8,7 @@ colors = 1
highlight_projects_contexts = 1 highlight_projects_contexts = 1
[ls] [ls]
list_limit = 25 list_limit = -1
[tags] [tags]
tag_start = t tag_start = t
......
...@@ -139,7 +139,7 @@ class FilterTest(unittest.TestCase): ...@@ -139,7 +139,7 @@ class FilterTest(unittest.TestCase):
filtered_todos = limit_filter.filter(todos) filtered_todos = limit_filter.filter(todos)
self.assertEquals([], filtered_todos) self.assertEquals(todos, filtered_todos)
def test_filter15(self): def test_filter15(self):
""" Test limit filter. """ """ Test limit filter. """
......
...@@ -38,7 +38,7 @@ class _Config: ...@@ -38,7 +38,7 @@ class _Config:
'archive_filename' : 'done.txt', 'archive_filename' : 'done.txt',
# ls # ls
'list_limit': '25', 'list_limit': '-1',
# tags # tags
'tag_start': 't', 'tag_start': 't',
......
...@@ -136,7 +136,7 @@ class InstanceFilter(Filter): ...@@ -136,7 +136,7 @@ class InstanceFilter(Filter):
class LimitFilter(Filter): class LimitFilter(Filter):
def __init__(self, p_limit): def __init__(self, p_limit):
self.limit = max(0, p_limit) self.limit = p_limit
def filter(self, p_todos): def filter(self, p_todos):
return p_todos[:self.limit] return p_todos[:self.limit] if self.limit >= 0 else p_todos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment