fix(picker): set current_line state earlier (#3052)

Sets the `current_line` global state earlier in the event loop rather
than in `get_results_completor`. This makes it safer to access
`current_line` earlier (eg. for building an entry).

(cherry picked from commit 52f500110b)
This commit is contained in:
James Trew
2024-05-20 11:39:48 +02:00
committed by Simon Hauser
parent cf3ce11a5d
commit 9194becd77
+1 -1
View File
@@ -479,6 +479,7 @@ function Picker:find()
local start_time = vim.loop.hrtime()
local prompt = self:_get_next_filtered_prompt()
state.set_global_key("current_line", prompt)
-- TODO: Entry manager should have a "bulk" setter. This can prevent a lot of redraws from display
if self.cache_picker == false or self.cache_picker.is_cached ~= true then
@@ -1333,7 +1334,6 @@ function Picker:get_result_completor(results_bufnr, find_id, prompt, status_upda
self:_do_selection(prompt)
state.set_global_key("current_line", self:_get_prompt())
status_updater { completed = true }
self:clear_extra_rows(results_bufnr)