Skip to content

Commit

Permalink
Do not full deepcopy vital-over object
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Apr 29, 2015
1 parent 782abc6 commit ace87ac
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions autoload/incsearch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -481,24 +481,16 @@ function! s:inc.on_char(cmdline) abort
endfunction

call s:cli.connect(s:inc)
"}}}

" Main: {{{

" @return vital-over command-line interface object. it's experimental!!!
function! incsearch#cli() abort
try
" It returns current cli object
return s:Doautocmd.get_cmdline()
catch /vital-over(_incsearch) Exception/
" If there are no current cli object, return default one
return s:cli
endtry
"" partial deepcopy() for cli.connect(module) instead of copy()
function! s:copy_cli(cli) abort
let cli = copy(a:cli)
let cli.variables = deepcopy(a:cli.variables)
return cli
endfunction

function! s:make_cli(config) abort
" deepcopy() for cli.connect(module) instead of copy()
let cli = deepcopy(s:cli)
let cli = s:copy_cli(s:cli)
let cli._base_key = a:config.command
let cli._vcount1 = a:config.count1
let cli._is_expr = a:config.is_expr
Expand All @@ -511,6 +503,21 @@ function! s:make_cli(config) abort
return cli
endfunction

"}}}

" Main: {{{

" @return vital-over command-line interface object. it's experimental!!!
function! incsearch#cli() abort
try
" It returns current cli object
return s:Doautocmd.get_cmdline()
catch /vital-over(_incsearch) Exception/
" If there are no current cli object, return default one
return s:cli
endtry
endfunction

" @api
function! incsearch#go(...) abort
let config = incsearch#config#make(get(a:, 1, {}))
Expand Down

0 comments on commit ace87ac

Please sign in to comment.