summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-11-13 14:56:57 -0500
committerTJ DeVries <devries.timothyj@gmail.com>2020-11-13 14:56:57 -0500
commit9fad317d0565e4e258d6fdea1279a5ace968549b (patch)
treeadf1b0f54cd94e9740266b961191d6005b7759ad /lua/telescope/pickers.lua
parent3e58e1ab7d4c80fec7d9b02e3f27503bd72f21ff (diff)
fix: #236
Diffstat (limited to 'lua/telescope/pickers.lua')
-rw-r--r--lua/telescope/pickers.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 43d3b96..d3bba7c 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -197,7 +197,13 @@ function Picker:get_reset_row()
end
end
+function Picker:is_done()
+ if not self.manager then return true end
+end
+
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
log.debug("Invalid results_bufnr for clearing:", results_bufnr)
return
@@ -412,6 +418,8 @@ function Picker:find()
-- self.manager = EntryManager:new(self.max_results, self.entry_adder, self.stats)
local process_result = function(entry)
+ if self:is_done() then return end
+
self:_increment("processed")
if not entry then
@@ -455,6 +463,8 @@ function Picker:find()
end
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
if selection_strategy == 'row' then
self:set_selection(self:get_selection_row())