mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-06-07 20:51:07 +00:00
fix: error message too many open files (#432)
and buffer previewer still "erroring" out for builtin.buffers
This commit is contained in:
@@ -68,7 +68,10 @@ end
|
|||||||
|
|
||||||
path.read_file_async = function(filepath, callback)
|
path.read_file_async = function(filepath, callback)
|
||||||
vim.loop.fs_open(filepath, "r", 438, function(err_open, fd)
|
vim.loop.fs_open(filepath, "r", 438, function(err_open, fd)
|
||||||
assert(not err_open, err_open)
|
if err_open then
|
||||||
|
print("We tried to open this file but couldn't. We failed with following error message: " .. err_open)
|
||||||
|
return
|
||||||
|
end
|
||||||
vim.loop.fs_fstat(fd, function(err_fstat, stat)
|
vim.loop.fs_fstat(fd, function(err_fstat, stat)
|
||||||
assert(not err_fstat, err_fstat)
|
assert(not err_fstat, err_fstat)
|
||||||
if stat.type ~= 'file' then return callback('') end
|
if stat.type ~= 'file' then return callback('') end
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ previewers.vimgrep = defaulter(function(_)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Workaround for unnamed buffer when using builtin.buffer
|
-- Workaround for unnamed buffer when using builtin.buffer
|
||||||
if p == '[No Name]' and entry.bufnr then
|
if entry.bufnr and (p == '[No Name]' or vim.api.nvim_buf_get_option(entry.bufnr, 'buftype') ~= '') then
|
||||||
local lines = vim.api.nvim_buf_get_lines(entry.bufnr, 0, -1, false)
|
local lines = vim.api.nvim_buf_get_lines(entry.bufnr, 0, -1, false)
|
||||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
jump_to_line(self, self.state.bufnr, entry.lnum)
|
jump_to_line(self, self.state.bufnr, entry.lnum)
|
||||||
|
|||||||
@@ -259,7 +259,11 @@ previewers.vimgrep = defaulter(function(opts)
|
|||||||
local height = vim.api.nvim_win_get_height(win_id)
|
local height = vim.api.nvim_win_get_height(win_id)
|
||||||
|
|
||||||
local p = from_entry.path(entry, true)
|
local p = from_entry.path(entry, true)
|
||||||
if p == nil or p == '' or p == '[No Name]' then return end
|
if p == nil or p == '' then return end
|
||||||
|
if entry.bufnr and (p == '[No Name]' or vim.api.nvim_buf_get_option(entry.bufnr, 'buftype') ~= '') then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local lnum = entry.lnum or 0
|
local lnum = entry.lnum or 0
|
||||||
|
|
||||||
local context = math.floor(height / 2)
|
local context = math.floor(height / 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user