Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/taskwiki.txt
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,15 @@ constructs.
Example:
let g:taskwiki_maplocalleader=",t"

*taskwiki_scan_for_duplicates*
If set to a non-empty value (such as "yes"), taskwiki will force-scan the
current file for other mentions of the task being processed and update
them too. This is useful if you have multiple overlapping viewports. If
you edit a task that appears in several of these viewports (e.g. mark it
as done) and save the file, the non-updated mentions of the task may undo
your edits. This option is disabled by default as it will add some
overhead to simple operations that you perform on selected tasks.

=============================================================================
9. TROUBLESHOOTING *taskwiki-trouble*

Expand Down
3 changes: 3 additions & 0 deletions taskwiki/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,6 @@ def get_relevant_tw(self):

def get_relevant_completion(self):
return self.completion[self.get_relevant_tw()]

def get_task_replications(self, uuid):
return [vwtask for vwtask in self.vwtask.values() if vwtask and vwtask.uuid == uuid]
14 changes: 14 additions & 0 deletions taskwiki/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def __init__(self):
self.tw = cache().get_relevant_tw()

# Load the current tasks
if util.get_var('taskwiki_scan_for_duplicates'):
for i in range(len(cache().buffer)):
cache().vwtask[i] # loads the line into the cache

range_tasks = [cache().vwtask[i] for i in util.selected_line_numbers()]
self.tasks = [t for t in range_tasks if t is not None]

Expand Down Expand Up @@ -114,6 +118,8 @@ def done(self):
vimwikitask.update_in_buffer()
print(u"Task \"{0}\" completed.".format(vimwikitask['description']))

self._update_replications()

cache().buffer.push()
self.save_action('done')

Expand Down Expand Up @@ -277,6 +283,14 @@ def sort(self, sortstring):
sort.TaskSorter(cache(), self.tasks, sortstring).execute()
cache().buffer.push()

def _update_replications(self):
"""Update all same tasks occurrences in current buffer from taskwarrior."""

for vimwikitask in self.tasks:
for replica in cache().get_task_replications(vimwikitask.uuid):
replica.update_from_task()
replica.update_in_buffer()


class Mappings(object):

Expand Down