Skip to content

Commit

Permalink
fix(picker): set current_line state earlier (#3052)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jamestrew committed May 16, 2024
1 parent 6f6bb80 commit 52f5001
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/telescope/pickers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ function Picker:find()
local start_time = vim.loop.hrtime()

local prompt = self:_get_next_filtered_prompt()
state.set_global_key("current_line", prompt)

if self.__locations_input == true then
local filename, line_number, column_number = utils.__separate_file_path_location(prompt)

Expand Down Expand Up @@ -1455,7 +1457,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)
Expand Down

0 comments on commit 52f5001

Please sign in to comment.