Commit af4af9ba authored by Bram Schoenmakers's avatar Bram Schoenmakers

Also hide tags that are preceded by punctuation.

The expression in the PrettyPrinterHideTagFilter expects that tag names
don't have any spaces around them, but this could be the case when
adding this to the configuration file:

 hide_tags = p, id

So make sure to strip off all spaces from tag names before passing them
along.
parent a0a50ba9
......@@ -199,6 +199,17 @@ class ListCommandTest(CommandTest):
self.assertEqual(self.output, "| 1| (C) Foo @Context2 Not@Context +Project1 Not+Project\n| 4| (C) Drink beer @ home\n| 5| (C) 13 + 29 = 42\n| 2| (D) Bar @Context1 +Project2\n")
self.assertEqual(self.errors, "")
def test_list22(self):
""" Handle tag lists with spaces and punctuation."""
config(p_overrides={('ls', 'hide_tags'): 'p, id'})
self.todolist = load_file_to_todolist('test/data/ListCommandTagTest.txt')
command = ListCommand(["-x"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, '| 1| Foo.\n')
def test_help(self):
command = ListCommand(["help"], self.todolist, self.out, self.error)
command.execute()
......
......@@ -197,7 +197,8 @@ class _Config:
""" Returns a list of tags to be hidden from the 'ls' output. """
hidden_tags = self.cp.get('ls', 'hide_tags')
# pylint: disable=no-member
return [] if hidden_tags == '' else hidden_tags.split(',')
return [] if hidden_tags == '' else [tag.strip() for tag in
hidden_tags.split(',')]
def priority_colors(self):
""" Returns a dict with priorities as keys and color numbers as value. """
......
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