mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-22 12:01:27 +08:00
Handle absolute windows paths in Grep/Ag/Ripgrep sink process (#1038)
Fix #1037 Function `ag_to_qf` is used to parse line produced by Grep, Ag or Ripgrep. Implementation in quesition split it using regexp that doesn't work for windows absolut paths. A better approach is to use `matchlist` function.
This commit is contained in:
@@ -669,11 +669,10 @@ endfunction
|
|||||||
" Ag / Rg
|
" Ag / Rg
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
function! s:ag_to_qf(line, has_column)
|
function! s:ag_to_qf(line, has_column)
|
||||||
let parts = split(a:line, '[^:]\zs:\ze[^:]')
|
let parts = matchlist(a:line, '\(.\{-}\):\(\d\+\)\%(:\(\d\+\)\)\?\%(:\(.*\)\)\?')
|
||||||
let text = join(parts[(a:has_column ? 3 : 2):], ':')
|
let dict = {'filename': &acd ? fnamemodify(parts[1], ':p') : parts[1], 'lnum': parts[2], 'text': parts[4]}
|
||||||
let dict = {'filename': &acd ? fnamemodify(parts[0], ':p') : parts[0], 'lnum': parts[1], 'text': text}
|
|
||||||
if a:has_column
|
if a:has_column
|
||||||
let dict.col = parts[2]
|
let dict.col = parts[3]
|
||||||
endif
|
endif
|
||||||
return dict
|
return dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user