From 5b98c7453f53453d4a0ebb5dc73d1f65ce676dcd Mon Sep 17 00:00:00 2001 From: Kien N Date: Tue, 4 Dec 2012 07:14:02 +0700 Subject: [PATCH] Set pos when data is empty Fixes #323 --- autoload/ctrlp.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 42ff1ed..aea5258 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -1990,7 +1990,7 @@ endf fu! s:insertcache(str) let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str] - if strlen(str) <= strlen(data[0]) + if data == [] || strlen(str) <= strlen(data[0]) let pos = 0 elsei strlen(str) >= strlen(data[-1]) let pos = len(data) - 1