Defend against broken g:FOREPLAY_HISTORY

Closes #26.
This commit is contained in:
Tim Pope 2013-01-04 09:35:32 -05:00
parent 3ff1633daa
commit 39d1e296cf
1 changed files with 3 additions and 2 deletions

View File

@ -536,7 +536,8 @@ function! s:actually_input(...)
endfunction endfunction
function! s:input(default) abort function! s:input(default) abort
if !exists('g:FOREPLAY_HISTORY') if !exists('g:FOREPLAY_HISTORY') || type(g:FOREPLAY_HISTORY) != type([])
unlet! g:FOREPLAY_HISTORY
let g:FOREPLAY_HISTORY = [] let g:FOREPLAY_HISTORY = []
endif endif
try try
@ -595,7 +596,7 @@ function! s:recall() abort
endtry endtry
endfunction endfunction
function! s:histswap(list) function! s:histswap(list) abort
let old = [] let old = []
for i in range(1, histnr('@') * (histnr('@') > 0)) for i in range(1, histnr('@') * (histnr('@') > 0))
call extend(old, [histget('@', i)]) call extend(old, [histget('@', i)])