mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-02-12 21:21:51 +08:00
[BLines] Fix incorrect line numbers when run with query (#694)
This commit is contained in:
@@ -406,7 +406,12 @@ endfunction
|
|||||||
|
|
||||||
function! s:buffer_lines(query)
|
function! s:buffer_lines(query)
|
||||||
let linefmt = s:yellow(" %4d ", "LineNr")."\t%s"
|
let linefmt = s:yellow(" %4d ", "LineNr")."\t%s"
|
||||||
return map(empty(a:query) ? getline(1, "$") : filter(getline(1, "$"), 'v:val =~ "'.a:query.'"'), 'printf(linefmt, v:key + 1, v:val)')
|
let fmtexpr = 'printf(linefmt, v:key + 1, v:val)'
|
||||||
|
let lines = getline(1, '$')
|
||||||
|
if empty(a:query)
|
||||||
|
return map(lines, fmtexpr)
|
||||||
|
end
|
||||||
|
return filter(map(lines, 'v:val =~ a:query ? '.fmtexpr.' : ""'), 'len(v:val)')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fzf#vim#buffer_lines(...)
|
function! fzf#vim#buffer_lines(...)
|
||||||
|
|||||||
Reference in New Issue
Block a user