diff options
| author | Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> | 2021-12-03 15:29:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-03 16:29:20 +0100 |
| commit | b50b364ae1eaf41feb88c11dc3e69d6e39f3ac04 (patch) | |
| tree | a259abdf09b95c8b85ea71bcb39b7ff6dd776658 /lua/telescope/make_entry.lua | |
| parent | 9d7d322f855aa1217b1bb303aafb1127bf7db470 (diff) | |
fix: check for Windows drive letter when parsing vimgrep (#1494)
Diffstat (limited to 'lua/telescope/make_entry.lua')
| -rw-r--r-- | lua/telescope/make_entry.lua | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 7892e05..ed20eba 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -110,9 +110,29 @@ do ordinal = 1, } + local find = (function() + if Path.path.sep == "\\" then + return function(t) + local start, _, filename, lnum, col, text = string.find(t.value, [[([^:]+):(%d+):(%d+):(.*)]]) + + -- Handle Windows drive letter (e.g. "C:") at the beginning (if present) + if start == 3 then + filename = string.sub(t.value, 1, 3) .. filename + end + + return filename, lnum, col, text + end + else + return function(t) + local _, _, filename, lnum, col, text = string.find(t.value, [[([^:]+):(%d+):(%d+):(.*)]]) + return filename, lnum, col, text + end + end + end)() + -- Gets called only once to parse everything out for the vimgrep, after that looks up directly. local parse = function(t) - local _, _, filename, lnum, col, text = string.find(t.value, [[([^:]+):(%d+):(%d+):(.*)]]) + local filename, lnum, col, text = find(t.value) local ok ok, lnum = pcall(tonumber, lnum) |
