fixed bugs in function s:allServersAway(). preventing action sent when editor first opened without file.

This commit is contained in:
Alan Hamlett 2013-06-25 22:58:13 -07:00
parent 633647ce78
commit e904799d68

View file

@ -88,11 +88,15 @@ function! s:GetCurrentFile()
endfunction endfunction
function! s:api(type, task) function! s:api(type, task)
if a:task != ''
exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) . " &" exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) . " &"
endif
endfunction endfunction
function! s:api_with_time(type, task, time) function! s:api_with_time(type, task, time)
if a:task != ''
exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) "--time" printf("%f", a:time) . " &" exec "silent !python " . s:plugin_directory . "/wakatime.py --key" g:wakatime_api_key "--instance" s:instance_id "--action" a:type "--task" shellescape(a:task) "--time" printf("%f", a:time) . " &"
endif
endfunction endfunction
function! s:getchar() function! s:getchar()
@ -103,7 +107,7 @@ function! s:getchar()
return c return c
endfunction endfunction
function! s:isAway() function! Wakatime_isAway()
return s:away_start return s:away_start
endfunction endfunction
@ -111,9 +115,11 @@ function! s:allServersAway()
if has('clientserver') if has('clientserver')
let servers = split(serverlist()) let servers = split(serverlist())
for server in servers for server in servers
if !remote_expr(server,'s:isAway()') if server != v:servername
if !remote_expr(server,'Wakatime_isAway()')
return 0 return 0
endif endif
endif
endfor endfor
endif endif
return 1 return 1