viewport: Properly handle the situation when non-matching task is represented in the viewport in multiple instances

This commit is contained in:
Tomas Babej 2015-03-21 18:42:43 +01:00
parent d794bfb13b
commit 8089c09101

View file

@ -77,13 +77,16 @@ class ViewPort(object):
# Remove tasks that no longer match the filter # Remove tasks that no longer match the filter
for task in to_del: for task in to_del:
# Find matching vimwikitask in the self.tasks set # Find matching vimwikitasks in the self.tasks set
[vimwikitask] = [t for t in self.tasks # There might be more if the viewport contained multiple
if t['uuid'] == task['uuid']] # representations of the same task
matching_vimwikitasks= [t for t in self.tasks
if t['uuid'] == task['uuid']]
# Remove the task from viewport's set and from buffer # Remove the tasks from viewport's set and from buffer
self.tasks.remove(vimwikitask) for vimwikitask in matching_vimwikitasks:
self.cache.remove_line(vimwikitask['line_number']) self.tasks.remove(vimwikitask)
self.cache.remove_line(vimwikitask['line_number'])
# Add the tasks that match the filter and are not listed # Add the tasks that match the filter and are not listed
added_tasks = 0 added_tasks = 0