Fix invalid type conversion

This commit is contained in:
Junegunn Choi
2013-09-20 23:19:32 +09:00
parent fce0a103ff
commit a2d52611ee

View File

@@ -514,11 +514,11 @@ function! s:input(str, default, vis)
call inputsave() call inputsave()
let got = input(a:str, a:default) let got = input(a:str, a:default)
call inputrestore() call inputrestore()
try return got
return eval(got) endfunction
catch
return got function! s:atoi(str)
endtry return (a:str =~ '^[0-9]\+$') ? str2nr(a:str) : a:str
endfunction endfunction
function! s:interactive(modes, vis) function! s:interactive(modes, vis)
@@ -565,9 +565,9 @@ function! s:interactive(modes, vis)
elseif ch == "\<C-I>" elseif ch == "\<C-I>"
let opts['idt'] = s:shift(vals['indentation'], 1) let opts['idt'] = s:shift(vals['indentation'], 1)
elseif ch == "\<C-L>" elseif ch == "\<C-L>"
let opts['lm'] = s:input("Left margin: ", get(opts, 'lm', ''), a:vis) let opts['lm'] = s:atoi(s:input("Left margin: ", get(opts, 'lm', ''), a:vis))
elseif ch == "\<C-R>" elseif ch == "\<C-R>"
let opts['rm'] = s:input("Right margin: ", get(opts, 'rm', ''), a:vis) let opts['rm'] = s:atoi(s:input("Right margin: ", get(opts, 'rm', ''), a:vis))
elseif ch == "\<C-U>" elseif ch == "\<C-U>"
let opts['iu'] = s:shift(vals['ignore_unmatched'], 1) let opts['iu'] = s:shift(vals['ignore_unmatched'], 1)
elseif ch == "\<C-G>" elseif ch == "\<C-G>"