mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
ViewPort: Add newly matched tasks to the cache and viewport set container properly
This commit is contained in:
parent
15fd8ae46d
commit
5f7814edd9
1 changed files with 6 additions and 4 deletions
|
@ -221,13 +221,14 @@ class ViewPort(object):
|
|||
|
||||
# Add the tasks that match the filter and are not listed
|
||||
added_tasks = 0
|
||||
existing_tasks = len(self.tasks)
|
||||
|
||||
sorted_to_add = list(to_add)
|
||||
sorted_to_add.sort(key=lambda x:x['entry'])
|
||||
|
||||
for task in sorted_to_add:
|
||||
added_tasks += 1
|
||||
added_at = self.line_number + len(self.tasks) + added_tasks
|
||||
added_at = self.line_number + existing_tasks + added_tasks
|
||||
|
||||
# Add the task object to cache
|
||||
self.cache[vwtask.ShortUUID(task['uuid'], self.tw)] = task
|
||||
|
@ -235,9 +236,10 @@ class ViewPort(object):
|
|||
# Create the VimwikiTask
|
||||
vimwikitask = vwtask.VimwikiTask.from_task(self.cache, task)
|
||||
vimwikitask['line_number'] = added_at
|
||||
|
||||
# Save it to cache
|
||||
self.cache[added_at] = vimwikitask
|
||||
self.tasks.add(vimwikitask)
|
||||
|
||||
# Update the buffer
|
||||
self.cache.insert_line(str(vimwikitask), added_at)
|
||||
|
||||
# Save it to cache
|
||||
self.cache[added_at] = vimwikitask
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue