This commit is contained in:
TJ DeVries
2020-11-13 14:56:57 -05:00
parent 3e58e1ab7d
commit 9fad317d05

View File

@@ -197,7 +197,13 @@ function Picker:get_reset_row()
end end
end end
function Picker:is_done()
if not self.manager then return true end
end
function Picker:clear_extra_rows(results_bufnr) function Picker:clear_extra_rows(results_bufnr)
if self:is_done() then return end
if not vim.api.nvim_buf_is_valid(results_bufnr) then if not vim.api.nvim_buf_is_valid(results_bufnr) then
log.debug("Invalid results_bufnr for clearing:", results_bufnr) log.debug("Invalid results_bufnr for clearing:", results_bufnr)
return return
@@ -412,6 +418,8 @@ function Picker:find()
-- self.manager = EntryManager:new(self.max_results, self.entry_adder, self.stats) -- self.manager = EntryManager:new(self.max_results, self.entry_adder, self.stats)
local process_result = function(entry) local process_result = function(entry)
if self:is_done() then return end
self:_increment("processed") self:_increment("processed")
if not entry then if not entry then
@@ -455,6 +463,8 @@ function Picker:find()
end end
local process_complete = function() local process_complete = function()
if self:is_done() then return end
-- TODO: We should either: always leave one result or make sure we actually clean up the results when nothing matches -- TODO: We should either: always leave one result or make sure we actually clean up the results when nothing matches
if selection_strategy == 'row' then if selection_strategy == 'row' then
self:set_selection(self:get_selection_row()) self:set_selection(self:get_selection_row())