mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Work around older Vims not accepting arguments for function().
Fixes #618.
This commit is contained in:
@@ -27,7 +27,12 @@ function! gitgutter#process_buffer(bufnr, force) abort
|
|||||||
|
|
||||||
call s:setup_maps(a:bufnr)
|
call s:setup_maps(a:bufnr)
|
||||||
|
|
||||||
let how = s:setup_path(a:bufnr, function('gitgutter#process_buffer', [a:bufnr, a:force]))
|
if has('patch-7.4.1559')
|
||||||
|
let l:Callback = function('gitgutter#process_buffer', [a:bufnr, a:force])
|
||||||
|
else
|
||||||
|
let l:Callback = {'function': 'gitgutter#process_buffer', 'arguments': [a:bufnr, a:force]}
|
||||||
|
endif
|
||||||
|
let how = s:setup_path(a:bufnr, l:Callback)
|
||||||
if [how] == ['async'] " avoid string-to-number conversion if how is a number
|
if [how] == ['async'] " avoid string-to-number conversion if how is a number
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -121,7 +121,11 @@ function! s:set_path_handler.out(buffer, path) abort
|
|||||||
let path = s:strip_trailing_new_line(a:path)
|
let path = s:strip_trailing_new_line(a:path)
|
||||||
call gitgutter#utility#setbufvar(a:buffer, 'path', path)
|
call gitgutter#utility#setbufvar(a:buffer, 'path', path)
|
||||||
|
|
||||||
call self.continuation()
|
if type(self.continuation) == type(function('tr'))
|
||||||
|
call self.continuation()
|
||||||
|
else
|
||||||
|
call call(self.continuation.function, self.continuation.arguments)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:set_path_handler.err(buffer) abort
|
function! s:set_path_handler.err(buffer) abort
|
||||||
@@ -129,7 +133,7 @@ function! s:set_path_handler.err(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" continuation - a funcref to call after setting the repo path asynchronously.
|
" continuation - a funcref or hash to call after setting the repo path asynchronously.
|
||||||
"
|
"
|
||||||
" Returns 'async' if the the path is set asynchronously, 0 otherwise.
|
" Returns 'async' if the the path is set asynchronously, 0 otherwise.
|
||||||
function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
|
function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
|
||||||
|
|||||||
Reference in New Issue
Block a user