mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +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
|
||||
" ------------------------------------------------------------------
|
||||
function! s:ag_to_qf(line, has_column)
|
||||
let parts = split(a:line, '[^:]\zs:\ze[^:]')
|
||||
let text = join(parts[(a:has_column ? 3 : 2):], ':')
|
||||
let dict = {'filename': &acd ? fnamemodify(parts[0], ':p') : parts[0], 'lnum': parts[1], 'text': text}
|
||||
let parts = matchlist(a:line, '\(.\{-}\):\(\d\+\)\%(:\(\d\+\)\)\?\%(:\(.*\)\)\?')
|
||||
let dict = {'filename': &acd ? fnamemodify(parts[1], ':p') : parts[1], 'lnum': parts[2], 'text': parts[4]}
|
||||
if a:has_column
|
||||
let dict.col = parts[2]
|
||||
let dict.col = parts[3]
|
||||
endif
|
||||
return dict
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user