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).
This commit is contained in:
@@ -636,6 +636,8 @@ function Picker:find()
|
|||||||
local start_time = vim.loop.hrtime()
|
local start_time = vim.loop.hrtime()
|
||||||
|
|
||||||
local prompt = self:_get_next_filtered_prompt()
|
local prompt = self:_get_next_filtered_prompt()
|
||||||
|
state.set_global_key("current_line", prompt)
|
||||||
|
|
||||||
if self.__locations_input == true then
|
if self.__locations_input == true then
|
||||||
local filename, line_number, column_number = utils.__separate_file_path_location(prompt)
|
local filename, line_number, column_number = utils.__separate_file_path_location(prompt)
|
||||||
|
|
||||||
@@ -1455,7 +1457,6 @@ function Picker:get_result_completor(results_bufnr, find_id, prompt, status_upda
|
|||||||
|
|
||||||
self:_do_selection(prompt)
|
self:_do_selection(prompt)
|
||||||
|
|
||||||
state.set_global_key("current_line", self:_get_prompt())
|
|
||||||
status_updater { completed = true }
|
status_updater { completed = true }
|
||||||
|
|
||||||
self:clear_extra_rows(results_bufnr)
|
self:clear_extra_rows(results_bufnr)
|
||||||
|
|||||||
Reference in New Issue
Block a user