From dfd54e1d33ba3b5dfe91146562b1824b7d142b0b Mon Sep 17 00:00:00 2001 From: Kien N Date: Thu, 5 Apr 2012 09:23:33 +0700 Subject: [PATCH] Pass str directly when match_func is used --- autoload/ctrlp.vim | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 7219efd..657d15d 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -331,11 +331,11 @@ fu! s:MatchIt(items, pat, limit, exc) retu lines endf -fu! s:MatchedItems(items, str, pat, limit) +fu! s:MatchedItems(items, pat, limit) let exc = exists('s:crfilerel') ? s:crfilerel : '' let items = s:narrowable() ? s:matched + s:mdata[3] : a:items - if s:matcher != {} && has_key(s:matcher, 'match') - let argms = [items, a:str, a:limit, s:mmode(), s:ispath, exc, s:regexp] + if s:matcher != {} + let argms = [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] let lines = call(s:matcher['match'], argms) el let lines = s:MatchIt(items, a:pat, a:limit, exc) @@ -417,9 +417,9 @@ fu! s:Update(str) let str = s:sanstail(a:str) " Stop if the string's unchanged if str == oldstr && !empty(str) && !exists('s:force') | retu | en - let pat = s:SplitPattern(str) + let pat = s:matcher == {} ? s:SplitPattern(str) : str let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines) - \ : s:MatchedItems(g:ctrlp_lines, str, pat, s:winh) + \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh) cal s:Render(lines, pat) endf @@ -1018,7 +1018,6 @@ fu! s:mixedsort(s1, s2) endf fu! s:multipliers(...) - " Dynamic multipliers let mp_1 = !a:1 ? 0 : 2 let mp_2 = !a:2 ? 0 : mp_1 + 1 let mp_3 = !a:3 ? 0 : ( !mp_2 ? mp_1 + 1 : mp_2 ) * 2 @@ -1051,7 +1050,7 @@ fu! ctrlp#statusline() let byfname = s:byfname ? 'file' : 'path' let marked = s:opmul != '0' ? \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' - if s:status != {} && has_key(s:status, 'main') + if s:status != {} let args = [focus, byfname, s:regexp, prv, item, nxt, marked] let &l:stl = call(s:status['main'], args) el @@ -1072,8 +1071,7 @@ endf fu! ctrlp#progress(enum) if has('macunix') || has('mac') | sl 1m | en - let &l:stl = s:status != {} && has_key(s:status, 'prog') - \ ? call(s:status['prog'], [a:enum]) + let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum]) \ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*' redraws endf