From c28a468e1fee22b1cac6afec6f46f66d7c5524a9 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 29 Dec 2014 10:45:11 +0100 Subject: [PATCH] update_from_tw: Use cache and GENERIC_TASK regexp --- autoload/vimwiki_pytasks.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/autoload/vimwiki_pytasks.py b/autoload/vimwiki_pytasks.py index 58eea90..84785b9 100644 --- a/autoload/vimwiki_pytasks.py +++ b/autoload/vimwiki_pytasks.py @@ -184,12 +184,11 @@ def update_from_tw(): for i in range(len(vim.current.buffer)): line = vim.current.buffer[i] - if re.search(TASKS_TO_SAVE_TO_TW, line): - task = VimwikiTask(line, i) - task.save_to_tw() - line = str(task) + if re.search(GENERIC_TASK, line): + task = cache[i] + task.update_from_tw() + task.update_in_buffer() - vim.current.buffer[i] = line number_of_lines = len(vim.current.buffer) vim.command('echom "lines: %d"' % number_of_lines)