feat: add actions.get_current_line (#391)

This commit is contained in:
oberblastmeister
2021-01-05 02:50:44 -05:00
committed by GitHub
parent 9503603f88
commit f750159203
2 changed files with 7 additions and 0 deletions

View File

@@ -43,6 +43,10 @@ function actions.get_selected_entry()
return state.get_global_key('selected_entry') return state.get_global_key('selected_entry')
end end
function actions.get_current_line()
return state.get_global_key('current_line')
end
function actions.preview_scrolling_up(prompt_bufnr) function actions.preview_scrolling_up(prompt_bufnr)
actions.get_current_picker(prompt_bufnr).previewer:scroll_fn(-30) actions.get_current_picker(prompt_bufnr).previewer:scroll_fn(-30)
end end

View File

@@ -524,6 +524,9 @@ function Picker:find()
error('Unknown selection strategy: ' .. selection_strategy) error('Unknown selection strategy: ' .. selection_strategy)
end end
local current_line = vim.api.nvim_get_current_line():sub(self.prompt_prefix:len() + 1)
state.set_global_key('current_line', current_line)
self:clear_extra_rows(results_bufnr) self:clear_extra_rows(results_bufnr)
self:highlight_displayed_rows(results_bufnr, prompt) self:highlight_displayed_rows(results_bufnr, prompt)