From 14310ee6b1f40425ba854d6ddc6374960fdf81ca Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 4 Sep 2020 09:49:10 -0400 Subject: fix: Don't push past midnight. You'll make clason's stuff break :/ --- lua/telescope/make_entry.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lua/telescope/make_entry.lua') diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index aca8894..09c7d30 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -28,7 +28,7 @@ function make_entry.gen_from_string() return function(line) return { valid = line ~= "", - entry_type = make_entry.types.SIMPLE, + entry_type = make_entry.types.GENERIC, value = line, ordinal = line, @@ -40,6 +40,8 @@ end function make_entry.gen_from_file(opts) opts = opts or {} + local cwd = vim.fn.expand(opts.cwd or vim.fn.getcwd()) + local make_display = function(line) local display = line if opts.shorten_path then @@ -58,6 +60,7 @@ function make_entry.gen_from_file(opts) entry_type = make_entry.types.FILE, filename = line, + path = cwd .. '/' .. line, } entry.display = make_display(line) @@ -101,6 +104,13 @@ function make_entry.gen_from_vimgrep(opts) -- Or could we just walk the text and check for colons faster? local _, _, filename, lnum, col, text = string.find(line, [[([^:]+):(%d+):(%d+):(.*)]]) + local ok + ok, lnum = pcall(tonumber, lnum) + if not ok then lnum = nil end + + ok, col = pcall(tonumber, col) + if not ok then col = nil end + return { valid = line ~= "", -- cgit v1.2.3