mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +08:00
Don't mutate args to fzf#vim#files() (#1282)
As the code was written before, if we do this:
let s:opts = {
\ 'window': {'width': 0.6, 'height': 0.6, 'relative': v:false},
\ 'options': ['--layout=reverse', '--info=inline'],
\}
call fzf#vim#files('', s:opts, 0)
...then s:opts will get mutated by the call to fzf#vim#files, cloberring
any persistent configuration established this way.
Making a defensive copy solves the problem.
This commit is contained in:
@@ -302,6 +302,7 @@ function! s:fzf(name, opts, extra)
|
||||
throw 'invalid number of arguments'
|
||||
endif
|
||||
|
||||
let extra = copy(extra)
|
||||
let eopts = has_key(extra, 'options') ? remove(extra, 'options') : ''
|
||||
let merged = extend(copy(a:opts), extra)
|
||||
call s:merge_opts(merged, eopts)
|
||||
|
||||
Reference in New Issue
Block a user