From cc281c47eb65b33bbf9f2c67e26f43ada92450b1 Mon Sep 17 00:00:00 2001 From: Jaime Alberto Sanchez Hidalgo Date: Tue, 20 Oct 2015 08:43:13 -0200 Subject: [PATCH 1/2] FIX getcurpos invalid expression --- autoload/todo.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/todo.vim b/autoload/todo.vim index 3e9c98c..83cb24f 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -35,7 +35,7 @@ function! todo#PrioritizeDecrease() endfunction function! todo#PrioritizeAdd (priority) - let oldpos=getcurpos() + let oldpos=getpos('.') let line=getline('.') if line !~ '^([A-F])' :call todo#PrioritizeAddAction(a:priority) From 45bfb325ae6be30c0c1c64d5c1a9bb29b69c3858 Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Tue, 8 Dec 2015 10:48:03 +0100 Subject: [PATCH 2/2] FIX getcurpos incompatibility with old versions It seems that getcurpos() (used on PrioritizeAdd) appeared on vim 7.4.313 therefore using it was causing troubles to some users ... --- autoload/todo.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/autoload/todo.vim b/autoload/todo.vim index fe7a58c..e177f51 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -23,6 +23,14 @@ endif " Functions {{{1 + +function! todo#GetCurpos() + if exists("*getcurpos") + return getcurpos() + endif + return getpos('.') +endfunction + " Increment and Decrement The Priority :set nf=octal,hex,alpha @@ -35,7 +43,7 @@ function! todo#PrioritizeDecrease() endfunction function! todo#PrioritizeAdd (priority) - let oldpos=getpos('.') + let oldpos=todo#GetCurpos() let line=getline('.') if line !~ '^([A-F])' :call todo#PrioritizeAddAction(a:priority) @@ -179,7 +187,7 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) let l:sortmodefinal=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_third_level_sort_mode) " Count the number of lines - let l:position= getpos(".") + let l:position= todo#GetCurpos() execute "silent normal g\" let l:linecount=str2nr(split(v:statusmsg)[7])